diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000000..92cde390ac --- /dev/null +++ b/.prettierrc @@ -0,0 +1,3 @@ +{ + "singleQuote": true +} \ No newline at end of file diff --git a/package.json b/package.json index 8c412093f1..101bfbd807 100644 --- a/package.json +++ b/package.json @@ -11,12 +11,25 @@ "clean": "lerna run clean", "integrity": "node scripts/package-integrity.js", "lint": "lerna run lint", + "integrity2": "node buildutils/lib/integrity.js", + "lint2": "yarn && yarn run prettier && yarn run tslint", + "lint:check": "yarn run prettier:check && yarn run tslint:check", + "prettier": "prettier --ignore-path .gitignore --write '**/*{.ts,.tsx,.js,.jsx,.css,.json,.md}'", + "prettier:check": "prettier --ignore-path .gitignore --check '**/*{.ts,.tsx,.js,.jsx,.css,.json,.md}'", + "sort-package-json": "lerna exec --parallel sort-package-json && sort-package-json", + "tslint": "tslint --fix -c tslint.json --project tsconfigbase.json '**/*{.ts,.tsx}'", + "tslint:check": "tslint -c tslint.json --project tsconfigbase.json '**/*{.ts,.tsx}'", "publish": "yarn run clean && yarn run build && lerna publish -m \"Publish npm packages\"", "update-dependency": "update-dependency --lerna", "updated": "lerna updated" }, "devDependencies": { "@jupyterlab/buildutils": "^2.0.0-beta.1", - "lerna": "^3.2.1" + "lerna": "^3.20.2", + "prettier": "^1.19.1", + "sort-package-json": "~1.35", + "tslint": "^5.20.1", + "tslint-config-prettier": "^1.18.0", + "tslint-plugin-prettier": "^2.1.0" } } diff --git a/tslint.json b/tslint.json index 18270aa786..f205de31bf 100644 --- a/tslint.json +++ b/tslint.json @@ -1,42 +1,28 @@ { + "rulesDirectory": ["tslint-plugin-prettier"], "rules": { - "align": [ - true, - "parameters", - "statements" - ], + "prettier": [true, { "singleQuote": true }], + "align": [true, "parameters", "statements"], + "await-promise": true, "ban": [ true, - [ "_", "forEach" ], - [ "_", "each" ], - [ "$", "each" ], - [ "angular", "forEach" ] + ["_", "forEach"], + ["_", "each"], + ["$", "each"], + ["angular", "forEach"] ], "class-name": true, - "comment-format": [ - true, - "check-space" - ], + "comment-format": [true, "check-space"], "curly": true, "eofline": true, "forin": false, - "indent": [ - true, - "spaces" - ], - "interface-name": [ - true, - "always-prefix" - ], + "indent": [true, "spaces", 2], + "interface-name": [true, "always-prefix"], "jsdoc-format": true, "label-position": true, - "max-line-length": [ - false - ], + "max-line-length": [false], "member-access": false, - "member-ordering": [ - false - ], + "member-ordering": [false], "new-parens": true, "no-angle-bracket-type-assertion": true, "no-any": false, @@ -44,26 +30,17 @@ "no-bitwise": true, "no-conditional-assignment": true, "no-consecutive-blank-lines": false, - "no-console": [ - true, - "debug", - "info", - "time", - "timeEnd", - "trace" - ], + "no-console": [true, "debug", "info", "time", "timeEnd", "trace"], "no-construct": true, "no-debugger": true, "no-default-export": false, "no-duplicate-variable": true, "no-empty": true, "no-eval": true, + "no-floating-promises": true, "no-inferrable-types": false, "no-internal-module": true, - "no-invalid-this": [ - true, - "check-function-in-method" - ], + "no-invalid-this": [true, "check-function-in-method"], "no-null-keyword": false, "no-reference": true, "no-require-imports": false, @@ -71,8 +48,6 @@ "no-string-literal": false, "no-switch-case-fall-through": true, "no-trailing-whitespace": true, - // "no-unused-expression": true, - "no-unused-variable": true, "no-use-before-declare": false, "no-var-keyword": true, "no-var-requires": true, @@ -85,16 +60,13 @@ "check-finally", "check-whitespace" ], - "one-variable-per-declaration": [true, - "ignore-for-loop" - ], - "quotemark": [ - true, - "single", - "avoid-escape" - ], + "one-variable-per-declaration": [true, "ignore-for-loop"], + "quotemark": { + "options": ["single", "avoid-escape"], + "severity": "off" + }, "radix": true, - "semicolon": [true, "always"], + "semicolon": [true, "always", "ignore-bound-class-methods"], "switch-default": true, "trailing-comma": [ false, @@ -103,14 +75,8 @@ "singleline": "never" } ], - "triple-equals": [ - true, - "allow-null-check", - "allow-undefined-check" - ], - "typedef": [ - false - ], + "triple-equals": [true, "allow-null-check", "allow-undefined-check"], + "typedef": [false], "typedef-whitespace": [ false, { @@ -129,14 +95,13 @@ } ], "use-isnan": true, - "use-strict": [ - false - ], + "use-strict": [false], "variable-name": [ true, - // "check-format", + "check-format", "allow-leading-underscore", - "ban-keywords" + "ban-keywords", + "allow-pascal-case" ], "whitespace": [ true, @@ -145,5 +110,8 @@ "check-separator", "check-type" ] + }, + "linterOptions": { + "exclude": ["node_modules/**/*.ts", "node_modules/**/*.tsx", "**/*.d.ts"] } -} \ No newline at end of file +}