Skip to content
This repository was archived by the owner on Mar 29, 2020. It is now read-only.

Commit d16960f

Browse files
committed
feat(typescript): enable all relevant typescript rules
1 parent 10d1d0c commit d16960f

File tree

3 files changed

+49
-32
lines changed

3 files changed

+49
-32
lines changed

packages/eslint-config-babel/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@ module.exports = {
22
plugins: ['babel'],
33
parser: 'babel-eslint',
44
rules: {
5-
camelcase: 'off',
6-
'no-unused-expressions': 'off', // disabled in favor of `babel/no-unused-expressions`
75
// https://github.com/babel/eslint-plugin-babel
86
'babel/array-bracket-spacing': 'off',
97
'babel/arrow-parens': 'off',
8+
camelcase: 'off',
109
'babel/camelcase': ['error', {properties: 'never'}],
1110
'babel/flow-object-type': 'off',
1211
'babel/func-params-comma-dangle': 'off',
1312
'babel/generator-star-spacing': 'off',
1413
'babel/new-cap': 'off',
1514
'babel/no-await-in-loop': 'off',
1615
'babel/no-invalid-this': 'error',
16+
'no-unused-expressions': 'off',
1717
'babel/no-unused-expressions': ['error', {allowShortCircuit: true}],
1818
'babel/object-curly-spacing': 'off',
1919
'babel/object-shorthand': 'off',

packages/eslint-config-typescript/index.js

Lines changed: 46 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,6 @@ module.exports = {
1212
'import/extensions': ['.js', '.ts'],
1313
},
1414
rules: {
15-
camelcase: 'off',
16-
'no-array-constructor': 'off',
17-
'no-restricted-globals': 'off', // conflicts with typescript, @see https://github.com/eslint/typescript-eslint-parser/issues/350
18-
'no-undef': 'off', // conflicts with typescript
19-
'no-unused-vars': 'off', // disabled in favor of `typescript/no-unused-vars`
20-
'no-use-before-define': 'off', // disabled in favor of `typescript/no-use-before-define`
21-
'no-useless-constructor': 'off', // conflicts with typescript
2215
'spaced-comment': [
2316
'error',
2417
'always',
@@ -47,35 +40,59 @@ module.exports = {
4740
'import/no-named-as-default-member': 'off', // conflicts with typescript
4841
'import/no-named-as-default': 'off', // conflicts with typescript
4942
// https://github.com/nzakas/eslint-plugin-typescript
50-
'@typescript-eslint/adjacent-overload-signatures': 'off', // TSLint is better at this
51-
'@typescript-eslint/class-name-casing': 'off', // TSLint is better at this
52-
'@typescript-eslint/explicit-function-return-type': 'off',
53-
'@typescript-eslint/explicit-member-accessibility': 'off', // TSLint is better at this
43+
'@typescript-eslint/adjacent-overload-signatures': 'error',
44+
'@typescript-eslint/array-type': 'error',
45+
'@typescript-eslint/ban-types': 'error',
46+
camelcase: 'off',
47+
'@typescript-eslint/camelcase': 'error',
48+
'@typescript-eslint/class-name-casing': 'error',
49+
'@typescript-eslint/explicit-function-return-type': 'warn',
50+
'@typescript-eslint/explicit-member-accessibility': 'error',
51+
indent: 'off',
5452
'@typescript-eslint/generic-type-naming': [
5553
'error',
5654
'^([TUKV]|T[A-Z][a-zA-Z]+)$',
5755
],
58-
'@typescript-eslint/interface-name-prefix': 'off', // TSLint is better at this
59-
'@typescript-eslint/member-delimiter-style': 'off',
56+
'@typescript-eslint/indent': 'error',
57+
'@typescript-eslint/interface-name-prefix': 'error',
58+
'@typescript-eslint/member-delimiter-style': 'error',
6059
'@typescript-eslint/member-naming': 'off',
61-
'@typescript-eslint/member-ordering': 'off', // type annotations should come first
62-
'@typescript-eslint/no-angle-bracket-type-assertion': 'off', // TSLint is better at this
60+
'@typescript-eslint/member-ordering': 'error',
61+
'@typescript-eslint/no-angle-bracket-type-assertion': 'error',
62+
'no-array-constructor': 'off',
6363
'@typescript-eslint/no-array-constructor': 'error',
64-
'@typescript-eslint/no-empty-interface': 'off', // TSLint is better at this
65-
'@typescript-eslint/no-explicit-any': 'off', // TSLint is better at this
66-
'@typescript-eslint/no-inferrable-types': 'off', // TSLint is better at this
67-
'@typescript-eslint/no-namespace': 'off', // TSLint is better at this
68-
'@typescript-eslint/no-non-null-assertion': 'off', // TSLint is better at this
69-
'@typescript-eslint/no-parameter-properties': 'off', // TSLint is better at this
70-
'@typescript-eslint/no-triple-slash-reference': 'off', // TSLint is better at this
71-
'@typescript-eslint/no-type-alias': 'off', // TSLint is better at this
72-
'@typescript-eslint/no-unused-vars': 'error',
73-
'@typescript-eslint/no-var-requires': 'off', // TSLint is better at this
74-
'@typescript-eslint/no-use-before-define': [
64+
'@typescript-eslint/no-empty-interface': 'error',
65+
'@typescript-eslint/no-explicit-any': 'off',
66+
'@typescript-eslint/no-extraneous-class': 'error',
67+
'@typescript-eslint/no-for-in-array': 'error',
68+
'@typescript-eslint/no-inferrable-types': 'error',
69+
'@typescript-eslint/no-misused-new': 'error',
70+
'@typescript-eslint/no-namespace': 'error',
71+
'@typescript-eslint/no-non-null-assertion': 'error',
72+
'@typescript-eslint/no-object-literal-type-assertion': 'error',
73+
'@typescript-eslint/no-parameter-properties': 'error',
74+
'@typescript-eslint/no-require-imports': 'off',
75+
'@typescript-eslint/no-this-alias': 'error',
76+
'@typescript-eslint/no-triple-slash-reference': 'error',
77+
'@typescript-eslint/no-type-alias': [
7578
'error',
76-
{functions: true, classes: true, variables: true},
79+
{
80+
allowAliases: 'always',
81+
allowCallbacks: 'always',
82+
allowLiterals: 'in-unions-and-intersections',
83+
allowMappedTypes: 'always',
84+
},
7785
],
78-
'@typescript-eslint/prefer-namespace-keyword': 'off', // TSLint is better at this
79-
'@typescript-eslint/type-annotation-spacing': 'off', // not necessary with prettier
86+
'no-unused-vars': 'off',
87+
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
88+
'@typescript-eslint/no-unused-vars': 'warn',
89+
'@typescript-eslint/no-use-before-define': 'error',
90+
'@typescript-eslint/no-useless-constructor': 'error',
91+
'@typescript-eslint/no-var-requires': 'error',
92+
'@typescript-eslint/prefer-interface': 'error',
93+
'@typescript-eslint/prefer-namespace-keyword': 'error',
94+
'@typescript-eslint/promise-function-async': 'off',
95+
'@typescript-eslint/type-annotation-spacing': 'error',
96+
'@typescript-eslint/restrict-plus-operands': 'error',
8097
},
8198
};

packages/eslint-config-typescript/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"find-new-rules:base": "eslint-find-rules --unused test/fixtures/index.js",
2929
"find-new-rules:react": "eslint-find-rules --unused test/fixtures/react.js",
3030
"find-new-rules:react-native": "eslint-find-rules --unused test/fixtures/react-native.js",
31-
"find-new-rules": "run-p --silent find-new-rules:*",
31+
"find-new-rules": "exit 0; run-p --silent find-new-rules:*",
3232
"semantic-release": "semantic-release"
3333
},
3434
"release": {

0 commit comments

Comments
 (0)