Skip to content

Commit

Permalink
add eslint and new tsconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
wclr committed Aug 21, 2020
1 parent 96af31b commit 141c033
Show file tree
Hide file tree
Showing 11 changed files with 1,313 additions and 526 deletions.
18 changes: 1 addition & 17 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,19 +1,3 @@
{
"extends": [
"airbnb-base/legacy"
],
"rules": {
"comma-dangle": [2, "never"],
"consistent-return": 0,
"eqeqeq": 0,
"func-names": 0,
"guard-for-in": 0,
"global-require": 0,
"one-var": [2, "never"],
"padded-blocks": 0,
"vars-on-top": 0,
"no-console": 0,
"no-param-reassign": 0,
"no-use-before-define": 0
}
"extends": ["@whitecolor/eslint-config"]
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.DS_Store
/node_modules
/lib
*.log
.ts-node
.tmp
10 changes: 9 additions & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@
"label": "tsc",
"command": "node",
// "isShellCommand": true,
"args": ["./node_modules/typescript/lib/tsc.js", "-w", "-p", "."],
"args": [
"./node_modules/typescript/lib/tsc.js",
"-w",
"-p",
"./tsconfig.build.json"
],
"presentation": {
"echo": true,
"reveal": "silent",
Expand All @@ -17,6 +22,9 @@
"clear": false,
"revealProblems": "always"
},
"runOptions": {
"runOn": "folderOpen"
},
//"showOutput": "silent",
"isBackground": true,
"problemMatcher": "$tsc-watch"
Expand Down
40 changes: 40 additions & 0 deletions .yalc/@whitecolor/eslint-config/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// eslint-disable-next-line no-undef
module.exports = {
env: {
browser: true,
es2020: true,
},
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"prettier",
],
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: 11,
sourceType: "module",
project: "./tsconfig.json",
},
plugins: ["@typescript-eslint", "only-warn"],
rules: {
"no-restricted-globals": ["warn", "localStorage"],
"no-restricted-properties": [
"warn",
{
object: "window",
property: "localStorage",
},
],
"no-console": ["warn", { allow: ["warn", "error"] }],

"@typescript-eslint/no-extra-semi": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/no-floating-promises": "warn",
"@typescript-eslint/no-misused-promises": "warn",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-non-null-assertion": "off",
},
};
24 changes: 24 additions & 0 deletions .yalc/@whitecolor/eslint-config/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "@whitecolor/eslint-config",
"version": "1.0.0+e899210a",
"main": "index.js",
"files": [
"index.js"
],
"prettier": {
"semi": false,
"singleQuote": true
},
"scripts": {
"test": "eslint test",
"prepublish": "pnpm test"
},
"dependencies": {
"@typescript-eslint/eslint-plugin": "^3.7.1",
"@typescript-eslint/parser": "^3.7.1",
"eslint": "^7.6.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-only-warn": "^1.0.2",
"typescript-eslint-language-service": "^3.0.0"
}
}
1 change: 1 addition & 0 deletions .yalc/@whitecolor/eslint-config/yalc.sig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
e899210a850f3694531a7113cbe29d33
25 changes: 15 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,11 @@
},
"license": "MIT",
"bin": {
"ts-node-dev": "./bin/ts-node-dev",
"tsnd": "./bin/ts-node-dev"
"ts-node-dev": "./lib/bin.js",
"tsnd": "./lib/bin.js"
},
"main": "./lib",
"files": [
"bin",
"icons",
"lib"
],
Expand All @@ -33,10 +32,10 @@
"node": ">=0.8.0"
},
"scripts": {
"ts-node-dev": "node ./bin/ts-node-dev",
"ts-node-dev": "node ./lib/bin",
"tsnd": "yarn ts-node-dev",
"test": "ts-node -T test/index.ts",
"test-dev": "ts-node-dev -T --respawn --deps --watch lib test/index.ts --output",
"test": "ts-node -T node_modules/mocha/bin/mocha test/*.test.ts",
"test-dev": "yarn ts-node-dev -T --respawn --deps --watch lib node_modules/mocha/bin/mocha test/*.test.ts --output",
"test-docker": "docker-compose up",
"ci": "yarn test",
"ci-local": "docker run --name travis-debug -dit quay.io/travisci/ci-nodejs",
Expand All @@ -56,18 +55,24 @@
"tsconfig": "^7.0.0"
},
"devDependencies": {
"@types/chai": "^4.2.12",
"@types/chokidar": "^2.1.3",
"@types/fs-extra": "^9.0.1",
"@types/minimist": "^1.2.0",
"@types/node": "^8.0.4",
"@types/mkdirp": "^1.0.1",
"@types/mocha": "github:whitecolor/mocha-types",
"@types/node": "^14.6.0",
"@types/rimraf": "^3.0.0",
"@types/tape": "^4.13.0",
"@types/touch": "^3.1.1",
"@types/ts-nameof": "^4.2.1",
"@whitecolor/eslint-config": "file:.yalc/@whitecolor/eslint-config",
"chai": "^4.2.0",
"coffee-script": "^1.8.0",
"eslint": "^2.0.0",
"eslint-config-airbnb-base": "^3.0.1",
"eslint-plugin-import": "^1.8.1",
"eslint": "^7.7.0",
"esm": "^3.2.22",
"fs-extra": "^9.0.1",
"mocha": "^8.1.1",
"tap": "^5.2.0",
"tape": "^5.0.1",
"touch": "^1.0.0",
Expand Down
8 changes: 8 additions & 0 deletions tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "./tsconfig",
"compilerOptions": {
"outDir": "./lib",
"noEmit": false
},
"include": ["src/**/*"]
}
30 changes: 9 additions & 21 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,13 @@
"target": "es5",
"lib": ["es2015"],
"module": "commonjs",
"declaration": true,
"sourceMap": true,
"strict": true,
"noFallthroughCasesInSwitch": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"outDir": "lib",
"allowJs": false,
"newLine": "LF",
"plugins": [
{
"name": "typescript-tslint-plugin",
"alwaysShowRuleFailuresAsWarnings": true
}
]
},
"formatCodeOptions": {
"indentSize": 2,
"tabSize": 2
},
"exclude": ["**/node_modules/*"]
"declaration": false,
"skipLibCheck": true,
"sourceMap": false,
"strict": true,
"noEmit": true,
"resolveJsonModule": true,
"esModuleInterop": true,
"newLine": "LF",
}
}
9 changes: 9 additions & 0 deletions yalc.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"version": "v1",
"packages": {
"@whitecolor/eslint-config": {
"signature": "e899210a850f3694531a7113cbe29d33",
"file": true
}
}
}
Loading

0 comments on commit 141c033

Please sign in to comment.