Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

Switch to tslint-plugin-prettier, clean up rule options config syntax #4488

Merged
merged 8 commits into from
Feb 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,3 @@ end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[tslint.json]
indent_size = 2
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
/scripts/*.js
/scripts/*.js.map
/lib/
/test/executable/tslint.json
node_modules/
!test/rules/**/node_modules
tscommand*.txt
Expand Down
36 changes: 0 additions & 36 deletions .prettierignore

This file was deleted.

19 changes: 0 additions & 19 deletions .prettierrc.json

This file was deleted.

2 changes: 2 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
"node_modules": true
},

"tslint.configFile": "tslint-vscode.json",

// Always use project's provided typescript compiler version
"typescript.tsdk": "node_modules/typescript/lib",
"files.eol": "\n"
Expand Down
13 changes: 5 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,8 @@
"compile:scripts": "tsc -p scripts",
"compile:test": "tsc -p test",
"lint": "npm-run-all -p lint:global lint:from-bin",
"lint:global": "tslint --project test/tsconfig.json --format stylish",
"lint:from-bin": "node bin/tslint --project test/tsconfig.json --format stylish",
"precommit": "npm-run-all precommit:prettier",
"precommit:prettier": "pretty-quick --staged",
"prettier": "prettier --write './**/*.{js,ts,css,scss,md,yml}' --ignore-path ./.prettierignore",
"lint:global": "tslint --project test/tsconfig.json --format codeFrame",
"lint:from-bin": "node bin/tslint --project test/tsconfig.json --format codeFrame",
"publish:local": "./scripts/npmPublish.sh",
"test": "npm-run-all test:pre -p test:mocha test:rules",
"test:pre": "cd ./test/config && npm install --no-save",
Expand Down Expand Up @@ -67,11 +64,11 @@
"npm-run-all": "^4.0.2",
"nyc": "^10.2.0",
"prettier": "1.14.3",
"pretty-quick": "^1.6.0",
"rimraf": "^2.5.4",
"ts-node": "^3.3.0",
"tslint": "^5.12.0",
"tslint-config-prettier": "^1.13.0",
"tslint": "~5.12.0",
"tslint-config-prettier": "^1.15.0",
"tslint-plugin-prettier": "^2.0.1",
"tslint-test-config-non-relative": "file:test/external/tslint-test-config-non-relative",
"typescript": "~3.1.6"
},
Expand Down
179 changes: 93 additions & 86 deletions src/configs/all.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,20 @@ export const rules = {
],
},
"ban-ts-ignore": true,
"member-access": [true, "check-accessor", "check-constructor", "check-parameter-property"],
"member-ordering": [
true,
{
"member-access": {
options: ["check-accessor", "check-constructor", "check-parameter-property"],
},
"member-ordering": {
options: {
order: "statics-first",
alphabetize: true,
},
],
},
"no-any": true,
"no-empty-interface": true,
"no-import-side-effect": true,
// Technically this is not the strictest setting, but don't want to conflict with "typedef"
"no-inferrable-types": [true, "ignore-params"],
"no-inferrable-types": { options: ["ignore-params"] },
"no-internal-module": true,
"no-magic-numbers": true,
"no-namespace": true,
Expand All @@ -64,33 +65,35 @@ export const rules = {
"prefer-for-of": true,
"prefer-readonly": true,
"promise-function-async": true,
typedef: [
true,
"call-signature",
"arrow-call-signature",
"parameter",
"arrow-parameter",
"property-declaration",
"variable-declaration",
"member-variable-declaration",
],
"typedef-whitespace": [
true,
{
"call-signature": "nospace",
"index-signature": "nospace",
parameter: "nospace",
"property-declaration": "nospace",
"variable-declaration": "nospace",
},
{
"call-signature": "onespace",
"index-signature": "onespace",
parameter: "onespace",
"property-declaration": "onespace",
"variable-declaration": "onespace",
},
],
typedef: {
options: [
"call-signature",
"arrow-call-signature",
"parameter",
"arrow-parameter",
"property-declaration",
"variable-declaration",
"member-variable-declaration",
],
},
"typedef-whitespace": {
options: [
{
"call-signature": "nospace",
"index-signature": "nospace",
parameter: "nospace",
"property-declaration": "nospace",
"variable-declaration": "nospace",
},
{
"call-signature": "onespace",
"index-signature": "onespace",
parameter: "onespace",
"property-declaration": "onespace",
"variable-declaration": "onespace",
},
],
},
"unified-signatures": true,

// Functionality
Expand All @@ -110,7 +113,7 @@ export const rules = {
"no-debugger": true,
"no-duplicate-super": true,
"no-duplicate-switch-case": true,
"no-duplicate-variable": [true, "check-parameters"],
"no-duplicate-variable": { options: ["check-parameters"] },
"no-dynamic-delete": true,
"no-empty": true,
"no-eval": true,
Expand All @@ -130,7 +133,7 @@ export const rules = {
"no-sparse-arrays": true,
"no-submodule-imports": true,
"no-unbound-method": true,
"no-unnecessary-class": [true, "allow-empty-class"],
"no-unnecessary-class": { options: ["allow-empty-class"] },
"no-unsafe-any": true,
"no-unsafe-finally": true,
"no-unused-expression": true,
Expand All @@ -153,11 +156,13 @@ export const rules = {

"cyclomatic-complexity": true,
eofline: true,
indent: [true, "spaces"],
"linebreak-style": [true, "LF"],
"max-classes-per-file": [true, 1],
"max-file-line-count": [true, 1000],
"max-line-length": [true, 120],
indent: { options: ["spaces"] },
"linebreak-style": { options: "LF" },
"max-classes-per-file": { options: 1 },
"max-file-line-count": { options: 1000 },
"max-line-length": {
options: { limit: 120 },
},
"no-default-export": true,
"no-default-import": true,
"no-duplicate-imports": true,
Expand All @@ -168,36 +173,36 @@ export const rules = {
"no-trailing-whitespace": true,
"object-literal-sort-keys": true,
"prefer-const": true,
"trailing-comma": [
true,
{
"trailing-comma": {
options: {
esSpecCompliant: true,
multiline: "always",
singleline: "never",
},
],
},

// Style

align: [true, "parameters", "arguments", "statements", "elements", "members"],
"array-type": [true, "array-simple"],
align: {
options: ["parameters", "arguments", "statements", "elements", "members"],
},
"array-type": { options: "array-simple" },
"arrow-parens": true,
"arrow-return-shorthand": [true, "multiline"],
"arrow-return-shorthand": { options: "multiline" },
"binary-expression-operand-order": true,
"callable-types": true,
"class-name": true,
"comment-format": [true, "check-space", "check-uppercase"],
"comment-type": [true, "singleline", "multiline", "doc", "directive"],
"comment-format": { options: ["check-space", "check-uppercase"] },
"comment-type": { options: ["singleline", "multiline", "doc", "directive"] },
"completed-docs": true,
// "file-header": No sensible default
deprecation: true,
encoding: true,
"file-name-casing": [true, "camel-case"],
"file-name-casing": { options: "camel-case" },
"import-spacing": true,
"increment-decrement": true,
"interface-name": true,
"interface-over-type-literal": true,
"jsdoc-format": [true, "check-multiline-start"],
"jsdoc-format": { options: "check-multiline-start" },
"match-default-export-name": true,
"new-parens": true,
"newline-before-return": true,
Expand All @@ -213,63 +218,65 @@ export const rules = {
"no-unnecessary-qualifier": true,
"no-unnecessary-type-assertion": true,
"number-literal-format": true,
"object-literal-key-quotes": [true, "consistent-as-needed"],
"object-literal-key-quotes": { options: "consistent-as-needed" },
"object-literal-shorthand": true,
"one-line": [
true,
"check-catch",
"check-else",
"check-finally",
"check-open-brace",
"check-whitespace",
],
"one-line": {
options: [
"check-catch",
"check-else",
"check-finally",
"check-open-brace",
"check-whitespace",
],
},
"one-variable-per-declaration": true,
"ordered-imports": [
true,
{
"ordered-imports": {
options: {
"grouped-imports": true,
"import-sources-order": "case-insensitive",
"named-imports-order": "case-insensitive",
"module-source-path": "full",
},
],
},
"prefer-function-over-method": true,
"prefer-method-signature": true,
"prefer-object-spread": true,
"prefer-switch": true,
"prefer-template": true,
"prefer-while": true,
quotemark: [true, "double", "avoid-escape", "avoid-template"],
quotemark: {
options: ["double", "avoid-escape", "avoid-template"],
},
"return-undefined": true,
semicolon: [true, "always"],
"space-before-function-paren": [
true,
{
semicolon: { options: ["always"] },
"space-before-function-paren": {
options: {
anonymous: "never",
asyncArrow: "always",
constructor: "never",
method: "never",
named: "never",
},
],
"space-within-parens": [true, 0],
},
"space-within-parens": { options: 0 },
"switch-final-break": true,
"type-literal-delimiter": true,
"unnecessary-bind": true,
"variable-name": [true, "ban-keywords", "check-format"],
whitespace: [
true,
"check-branch",
"check-decl",
"check-operator",
"check-module",
"check-separator",
"check-type",
"check-typecast",
"check-preblock",
"check-type-operator",
"check-rest-spread",
],
"variable-name": { options: ["ban-keywords", "check-format"] },
whitespace: {
options: [
"check-branch",
"check-decl",
"check-operator",
"check-module",
"check-separator",
"check-type",
"check-typecast",
"check-preblock",
"check-type-operator",
"check-rest-spread",
],
},
};

export const RULES_EXCLUDED_FROM_ALL_CONFIG = [
Expand Down
Loading