-
Notifications
You must be signed in to change notification settings - Fork 404
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #529 from kian2attari/bolt-tslint-to-eslint
Bolt tslint to eslint
- Loading branch information
Showing
36 changed files
with
937 additions
and
685 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
module.exports = { | ||
env: { | ||
es6: true, | ||
node: true, | ||
}, | ||
extends: [ | ||
'airbnb-typescript/base', | ||
/* TODO: Uncomment rule below once jsdoc comments are added. | ||
This matches the jsdoc rules in the TSLint config */ | ||
// "plugin:jsdoc/recommended", | ||
'prettier', | ||
'prettier/@typescript-eslint', | ||
'./eslint-config-base', // the common settings in eslint-config-base | ||
], | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
project: './tsconfig.eslint.json', | ||
}, | ||
plugins: ['@typescript-eslint'], | ||
ignorePatterns: ['**/*.spec.ts', 'src/test-helpers.ts'], | ||
rules: { | ||
/* Below are some of the new 'airbnb-typescript' rules that the project currently does not follow. | ||
They've been disabled here since they raise errors in a few files. The best course | ||
of action is likely to adopt these rules and make the quick (and mostly automated) fixes | ||
needed in the repo to conform to these. ESLint and the airbnb-typecript config is more strict | ||
than the original TSLint configuration that this project had. */ | ||
'import/first': ['off'], | ||
'import/prefer-default-export': ['off'], | ||
'max-classes-per-file': ['off', 1], | ||
'import/no-cycle': ['off'], | ||
'@typescript-eslint/no-use-before-define': 'off', | ||
'no-nested-ternary': 'off', | ||
'consistent-return': 'off', | ||
// 'import/order': ['off'], | ||
// 'import/newline-after-import': ['off'], | ||
// 'import/no-useless-path-segments': ['off'], | ||
// '@typescript-eslint/lines-between-class-members': 'off', | ||
// 'no-restricted-globals': 'off', | ||
// 'no-lonely-if': 'off', | ||
// 'no-undef-init': 'off', | ||
// 'no-multi-assign': 'off', | ||
// 'prefer-object-spread': 'off', | ||
// 'no-restricted-syntax': 'off', | ||
// 'prefer-destructuring': 'off', | ||
|
||
/* Some currently-enabled additional rules. Uncomment to disable. The project currently conforms to them | ||
so there it's best to just keep these commented or delete them entirely */ | ||
// '@typescript-eslint/ban-types': 'off', | ||
// '@typescript-eslint/no-empty-interface': 'off', | ||
// '@typescript-eslint/no-unsafe-assign': 'off', | ||
// '@typescript-eslint/no-explicit-any': 'off', | ||
// '@typescript-eslint/no-unsafe-member-access': 'off', | ||
// '@typescript-eslint/no-unsafe-return': 'off', | ||
// '@typescript-eslint/no-unnecessary-type-assertion': 'off', | ||
// '@typescript-eslint/no-non-null-assertion': 'off', | ||
// '@typescript-eslint/no-unsafe-assignment': 'off', | ||
// '@typescript-eslint/no-unsafe-call': 'off', | ||
// '@typescript-eslint/restrict-template-expressions': 'off', | ||
// '@typescript-eslint/unbound-method': 'off', | ||
// '@typescript-eslint/explicit-module-boundary-types': 'off', | ||
// '@typescript-eslint/require-await': 'off', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
module.exports = { | ||
extends: [ | ||
'plugin:@typescript-eslint/recommended-requiring-type-checking', | ||
'./eslint-config-base', | ||
], | ||
env: { | ||
commonjs: true, | ||
mocha: true, | ||
}, | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
project: './tsconfig.test.json', | ||
}, | ||
plugins: ['@typescript-eslint'], | ||
rules: { | ||
/* The rules below currently raise errors. They are easy and mostly automated fixes so conforming to them | ||
would be a good idea. Make sure to remove the rules below if you chose to adopt these rules. */ | ||
'@typescript-eslint/no-unsafe-member-access': 'off', | ||
'@typescript-eslint/no-unsafe-assignment': 'off', | ||
'@typescript-eslint/require-await': 'off', | ||
'@typescript-eslint/restrict-template-expressions': 'off', | ||
'@typescript-eslint/no-unnecessary-type-assertion': 'warn', | ||
'prefer-rest-params': 'off', | ||
'brace-style': 'off', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"singleQuote": true, | ||
"trailingComma": "all", | ||
"printWidth": 120, | ||
"overrides": [ | ||
{ | ||
"files": "*.ts", | ||
"options": { | ||
"parser": "typescript" | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,26 @@ | ||
/* | ||
👋 Hi! This file was autogenerated by tslint-to-eslint-config. | ||
https://github.com/typescript-eslint/tslint-to-eslint-config | ||
|
||
It represents the closest reasonable ESLint configuration to this | ||
project's original TSLint configuration. | ||
|
||
We recommend eventually switching this configuration to extend from | ||
the recommended rulesets in typescript-eslint. | ||
https://github.com/typescript-eslint/tslint-to-eslint-config/blob/master/docs/FAQs.md | ||
|
||
Happy linting! 💖 | ||
*/ | ||
{ | ||
"editor.rulers": [120], | ||
"typescript.tsdk": "node_modules/typescript/lib" | ||
"editor.rulers": [120], | ||
"typescript.tsdk": "node_modules/typescript/lib", | ||
"editor.formatOnSave": false, | ||
"[javascript]": { | ||
"editor.formatOnSave": true | ||
}, | ||
"[typescript]": { | ||
"editor.formatOnSave": true | ||
}, | ||
"prettier.configPath": ".prettierrc.json", | ||
"editor.tabSize": 2, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
module.exports = { | ||
rules: { | ||
// The rules below are ESLint equivalents for the old TSLint rules in tslint.json | ||
// Matches the quotemark rule | ||
'@typescript-eslint/quotes': [ | ||
'error', | ||
'single', | ||
{ | ||
'avoidEscape': true, | ||
'allowTemplateLiterals': false, | ||
}, | ||
], | ||
// matches the variable-name rule | ||
'@typescript-eslint/naming-convention': [ | ||
'error', | ||
// custom rule to ignore cases that require quoting | ||
{ | ||
'selector': 'variableLike', | ||
'format': ['camelCase', 'UPPER_CASE'], | ||
'leadingUnderscore': 'allow', | ||
'filter': { | ||
// you can expand this regex as you find more cases that require quoting that you want to allow | ||
'regex': '[_ ]', | ||
'match': false, | ||
}, | ||
}, | ||
], | ||
// matches ban-comma-operator rule | ||
'no-sequences': 'error', | ||
// matches the await-promise rule | ||
'@typescript-eslint/await-thenable': 'error', | ||
// matches interface-over-type-literal rule | ||
'@typescript-eslint/consistent-type-definitions': 'error', | ||
// matches member-access rule | ||
'@typescript-eslint/explicit-member-accessibility': [ | ||
'error', | ||
{ | ||
'accessibility': 'explicit', | ||
'overrides': { | ||
'constructors': 'no-public', | ||
}, | ||
}, | ||
], | ||
// matches no-duplicate-switch-case | ||
'no-duplicate-case': 'error', | ||
// matches no-duplicate-variable | ||
'no-redeclare': 'error', | ||
// matches no-require-imports | ||
'@typescript-eslint/no-require-imports': 'error', | ||
// matches no-return-await | ||
'no-return-await': 'error', | ||
// matches no-submodule-imports (slightly different) | ||
// "import/no-internal-modules": "error", | ||
// matches no-this-assignment | ||
'@typescript-eslint/no-this-alias': 'error', | ||
// matches no-unused-expression | ||
'@typescript-eslint/no-unused-expressions': 'error', | ||
// matches no-var-requires | ||
'@typescript-eslint/no-var-requires': 'error', | ||
// sorta matches one-line (Prettier takes care of this) | ||
'brace-style': ['error', '1tbs'], | ||
// matches strict-boolean-expressions | ||
'@typescript-eslint/strict-boolean-expressions': 'error', | ||
// matches typedef | ||
// REVIEW: This raised errors in a couple of the files. To view these errors, its value from 'off' to 'error' | ||
'@typescript-eslint/explicit-function-return-type': 'off', | ||
// matches typedef-whitespace | ||
'@typescript-eslint/type-annotation-spacing': 'error', | ||
// max-line-length is matched by Prettier | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.