@w5s/eslint-config 1.0.0-alpha.3 → 1.0.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/rules/base.js +1 -1
- package/rules/import.js +14 -107
- package/rules/jest.js +24 -24
- package/rules/typescript.js +153 -54
- package/rules/unicorn.js +17 -17
- package/ts.js +19 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@w5s/eslint-config",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.4",
|
|
4
4
|
"description": "ESLint configuration presets",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -77,5 +77,5 @@
|
|
|
77
77
|
"publishConfig": {
|
|
78
78
|
"access": "public"
|
|
79
79
|
},
|
|
80
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "cd7eb2b021bb3c9dbc91375cece5349173a7c81a"
|
|
81
81
|
}
|
package/rules/base.js
CHANGED
|
@@ -7,7 +7,7 @@ module.exports = concatESConfig(
|
|
|
7
7
|
require('eslint-config-airbnb-base/rules/errors'),
|
|
8
8
|
// @ts-ignore
|
|
9
9
|
require('eslint-config-airbnb-base/rules/es6'),
|
|
10
|
-
|
|
10
|
+
/** {@link ./import.js} */
|
|
11
11
|
// require('eslint-config-airbnb-base/rules/imports'),
|
|
12
12
|
// @ts-ignore
|
|
13
13
|
require('eslint-config-airbnb-base/rules/node'),
|
package/rules/import.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const { off, warn, error } = require('./_rule');
|
|
1
|
+
const { off, warn, error, concatESConfig, fixme } = require('./_rule');
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @see https://github.com/typescript-eslint/typescript-eslint/blob/master/docs/getting-started/linting/FAQ.md#eslint-plugin-import
|
|
@@ -7,110 +7,17 @@ const { off, warn, error } = require('./_rule');
|
|
|
7
7
|
// eslint-disable-next-line no-unused-vars
|
|
8
8
|
const performanceIssue = (_status) => off;
|
|
9
9
|
|
|
10
|
-
module.exports =
|
|
11
|
-
|
|
12
|
-
rules
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
error,
|
|
18
|
-
'
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
json: 'always',
|
|
22
|
-
jsx: 'never',
|
|
23
|
-
mjs: 'never',
|
|
24
|
-
ts: 'never',
|
|
25
|
-
tsx: 'never',
|
|
26
|
-
},
|
|
27
|
-
],
|
|
28
|
-
'import/first': [error, 'absolute-first'],
|
|
29
|
-
'import/group-exports': off,
|
|
30
|
-
'import/max-dependencies': [
|
|
31
|
-
off,
|
|
32
|
-
{
|
|
33
|
-
max: 10,
|
|
34
|
-
},
|
|
35
|
-
],
|
|
36
|
-
'import/named': error,
|
|
37
|
-
'import/namespace': error,
|
|
38
|
-
'import/newline-after-import': error,
|
|
39
|
-
'import/no-absolute-path': error,
|
|
40
|
-
'import/no-amd': error,
|
|
41
|
-
'import/no-anonymous-default-export': off,
|
|
42
|
-
'import/no-commonjs': off, // Still used widely by nodejs programs
|
|
43
|
-
'import/no-cycle': [error, { maxDepth: Number.POSITIVE_INFINITY }], // Elm, ReasonML forbids circular dependency
|
|
44
|
-
'import/no-default-export': off,
|
|
45
|
-
'import/no-deprecated': performanceIssue(warn),
|
|
46
|
-
'import/no-duplicates': error,
|
|
47
|
-
'import/no-dynamic-require': error,
|
|
48
|
-
'import/no-extraneous-dependencies': [
|
|
49
|
-
error,
|
|
50
|
-
{
|
|
51
|
-
// https://github.com/airbnb/javascript/blob/1eadb93e377da1e56c3f91f26610e5d0a00738a9/packages/eslint-config-airbnb-base/rules/imports.js#L71
|
|
52
|
-
devDependencies: [
|
|
53
|
-
'test/**', // tape, common npm pattern
|
|
54
|
-
'tests/**', // also common npm pattern
|
|
55
|
-
'spec/**', // mocha, rspec-like pattern
|
|
56
|
-
'**/__tests__/**', // jest pattern
|
|
57
|
-
'**/__mocks__/**', // jest pattern
|
|
58
|
-
'test.{js,jsx,ts,tsx}', // repos with a single test file
|
|
59
|
-
'test-*.{js,jsx,ts,tsx}', // repos with multiple top-level test files
|
|
60
|
-
'**/*{.,_}{test,spec}.{js,jsx,ts,tsx}', // tests where the extension or filename suffix denotes that it is a test
|
|
61
|
-
'**/jest.config.{js,ts}', // jest config
|
|
62
|
-
'**/jest.setup.{js,ts}', // jest setup
|
|
63
|
-
'**/vue.config.{js,ts}', // vue-cli config
|
|
64
|
-
'**/webpack.config.js', // webpack config
|
|
65
|
-
'**/webpack.config.*.js', // webpack config
|
|
66
|
-
'**/rollup.config.js', // rollup config
|
|
67
|
-
'**/rollup.config.*.js', // rollup config
|
|
68
|
-
'**/gulpfile.js', // gulp config
|
|
69
|
-
'**/gulpfile.*.js', // gulp config
|
|
70
|
-
'**/Gruntfile{,.js}', // grunt config
|
|
71
|
-
'**/protractor.conf.js', // protractor config
|
|
72
|
-
'**/protractor.conf.*.js', // protractor config
|
|
73
|
-
'**/karma.conf.js', // karma config
|
|
74
|
-
'**/.eslintrc.js', // eslint config,
|
|
75
|
-
'**/markdown.config.js', // markdown magic config,
|
|
76
|
-
],
|
|
77
|
-
optionalDependencies: false,
|
|
78
|
-
},
|
|
79
|
-
],
|
|
80
|
-
'import/no-internal-modules': off,
|
|
81
|
-
'import/no-mutable-exports': error,
|
|
82
|
-
'import/no-named-as-default': performanceIssue(error),
|
|
83
|
-
'import/no-named-as-default-member': error,
|
|
84
|
-
'import/no-named-default': error,
|
|
85
|
-
'import/no-named-export': off,
|
|
86
|
-
'import/no-namespace': off,
|
|
87
|
-
'import/no-nodejs-modules': off,
|
|
88
|
-
'import/no-relative-parent-imports': off,
|
|
89
|
-
'import/no-restricted-paths': off,
|
|
90
|
-
'import/no-self-import': error,
|
|
91
|
-
'import/no-unassigned-import': off,
|
|
92
|
-
'import/no-unresolved': [error, { caseSensitive: true, commonjs: true }],
|
|
93
|
-
'import/no-unused-modules': [performanceIssue(error), { unusedExports: true }],
|
|
94
|
-
'import/no-useless-path-segments': error,
|
|
95
|
-
'import/no-webpack-loader-syntax': error,
|
|
96
|
-
'import/order': [
|
|
97
|
-
error,
|
|
98
|
-
{
|
|
99
|
-
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
|
|
100
|
-
'newlines-between': 'never',
|
|
101
|
-
},
|
|
102
|
-
],
|
|
103
|
-
'import/prefer-default-export': off,
|
|
104
|
-
'import/unambiguous': off, // Disable because proposal still in progress
|
|
105
|
-
},
|
|
106
|
-
settings: {
|
|
107
|
-
'import/core-modules': [],
|
|
108
|
-
'import/extensions': ['.js', '.mjs', '.jsx'],
|
|
109
|
-
'import/ignore': ['node_modules', '\\.(coffee|scss|css|less|hbs|svg|json)$'],
|
|
110
|
-
'import/resolver': {
|
|
111
|
-
node: {
|
|
112
|
-
extensions: ['.mjs', '.js', '.json'],
|
|
113
|
-
},
|
|
10
|
+
module.exports = concatESConfig(
|
|
11
|
+
// @ts-ignore
|
|
12
|
+
require('eslint-config-airbnb-base/rules/imports'),
|
|
13
|
+
// Overrides
|
|
14
|
+
{
|
|
15
|
+
rules: {
|
|
16
|
+
'import/no-deprecated': performanceIssue(warn),
|
|
17
|
+
'import/no-named-as-default': performanceIssue(error),
|
|
18
|
+
'import/no-unused-modules': performanceIssue(error),
|
|
19
|
+
'import/prefer-default-export': off, // Not aligned, default export does not bring sufficient semantic
|
|
20
|
+
'import/unambiguous': fixme(off), // Disable because proposal still in progress
|
|
114
21
|
},
|
|
115
|
-
}
|
|
116
|
-
|
|
22
|
+
}
|
|
23
|
+
);
|
package/rules/jest.js
CHANGED
|
@@ -1,25 +1,13 @@
|
|
|
1
|
-
const { off, error } = require('./_rule');
|
|
1
|
+
const { off, error, concatESConfig } = require('./_rule');
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
'@typescript-eslint/restrict-template-expressions': off,
|
|
12
|
-
'@typescript-eslint/unbound-method': off,
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
module.exports = {
|
|
16
|
-
env: {
|
|
17
|
-
jest: true,
|
|
18
|
-
},
|
|
19
|
-
extends: ['plugin:jest/recommended'],
|
|
20
|
-
plugins: ['jest'],
|
|
21
|
-
rules: Object.assign(
|
|
22
|
-
{
|
|
3
|
+
module.exports = concatESConfig(
|
|
4
|
+
{
|
|
5
|
+
env: {
|
|
6
|
+
jest: true,
|
|
7
|
+
},
|
|
8
|
+
extends: ['plugin:jest/recommended'],
|
|
9
|
+
plugins: ['jest'],
|
|
10
|
+
rules: {
|
|
23
11
|
'jest/expect-expect': off, // Disabled because it does not handle functions that does the expect
|
|
24
12
|
'jest/no-alias-methods': error,
|
|
25
13
|
'jest/no-commented-out-tests': error,
|
|
@@ -41,6 +29,18 @@ module.exports = {
|
|
|
41
29
|
'jest/valid-expect': error,
|
|
42
30
|
'jest/valid-title': [error, { ignoreTypeOfDescribeName: true }],
|
|
43
31
|
},
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
32
|
+
},
|
|
33
|
+
/**
|
|
34
|
+
* Typescript config is set to be less strict because we often have "hack", "mock" in tests
|
|
35
|
+
*/
|
|
36
|
+
{
|
|
37
|
+
rules: {
|
|
38
|
+
'@typescript-eslint/no-unsafe-assignment': off,
|
|
39
|
+
'@typescript-eslint/no-unsafe-call': off,
|
|
40
|
+
'@typescript-eslint/no-unsafe-member-access': off,
|
|
41
|
+
'@typescript-eslint/no-unsafe-return': off,
|
|
42
|
+
'@typescript-eslint/restrict-template-expressions': off,
|
|
43
|
+
'@typescript-eslint/unbound-method': off,
|
|
44
|
+
},
|
|
45
|
+
}
|
|
46
|
+
);
|
package/rules/typescript.js
CHANGED
|
@@ -1,56 +1,24 @@
|
|
|
1
|
-
|
|
1
|
+
// Inspired by https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
|
|
2
|
+
|
|
3
|
+
const { fixme, off, warn, error, concatESConfig } = require('./_rule');
|
|
2
4
|
const { rules: _baseRules } = require('./base');
|
|
5
|
+
const { rules: _baseImportRules } = require('./import');
|
|
3
6
|
|
|
4
|
-
// Fix : TS pluging seems to modify the rules
|
|
5
|
-
const
|
|
7
|
+
// Fix Hack : TS pluging seems to modify the rules
|
|
8
|
+
const deepClone = (/** @type {Record<string, unknown>} */ anyValue) => JSON.parse(JSON.stringify(anyValue));
|
|
9
|
+
const baseRules = deepClone(_baseRules);
|
|
10
|
+
const baseImportRules = deepClone(_baseImportRules);
|
|
6
11
|
|
|
7
12
|
const duplicateTSC = off; // = "off because tsc already checks that"
|
|
8
13
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
'import/named': duplicateTSC,
|
|
18
|
-
'import/namespace': duplicateTSC,
|
|
19
|
-
'import/no-named-as-default-member': duplicateTSC,
|
|
20
|
-
'import/no-unresolved': duplicateTSC,
|
|
21
|
-
'no-array-constructor': off,
|
|
22
|
-
'no-const-assign': off,
|
|
23
|
-
'no-dupe-args': off,
|
|
24
|
-
'no-dupe-class-members': off,
|
|
25
|
-
'no-dupe-keys': off,
|
|
26
|
-
'no-empty-function': off,
|
|
27
|
-
'no-func-assign': off,
|
|
28
|
-
'no-import-assign': off,
|
|
29
|
-
'no-inner-declarations': fixme(error), // https://github.com/typescript-eslint/typescript-eslint/issues/239
|
|
30
|
-
'no-new-symbol': off,
|
|
31
|
-
'no-obj-calls': off,
|
|
32
|
-
'no-redeclare': off,
|
|
33
|
-
'no-setter-return': off,
|
|
34
|
-
'no-shadow': off, // https://github.com/typescript-eslint/typescript-eslint/issues/2483
|
|
35
|
-
'no-this-before-super': off,
|
|
36
|
-
'no-undef': off,
|
|
37
|
-
'no-unreachable': off,
|
|
38
|
-
'no-unsafe-negation': off,
|
|
39
|
-
'no-unused-vars': off,
|
|
40
|
-
'no-use-before-define': off,
|
|
41
|
-
'no-useless-constructor': off,
|
|
42
|
-
'no-var': error,
|
|
43
|
-
'prefer-const': error,
|
|
44
|
-
'prefer-rest-params': error,
|
|
45
|
-
'prefer-spread': error,
|
|
46
|
-
'valid-typeof': off,
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
module.exports = {
|
|
50
|
-
extends: ['plugin:@typescript-eslint/recommended-requiring-type-checking'],
|
|
51
|
-
plugins: ['@typescript-eslint', 'import'],
|
|
52
|
-
rules: Object.assign(
|
|
53
|
-
{
|
|
14
|
+
module.exports = concatESConfig(
|
|
15
|
+
/**
|
|
16
|
+
* Plugin rules
|
|
17
|
+
*/
|
|
18
|
+
{
|
|
19
|
+
extends: ['plugin:@typescript-eslint/recommended-requiring-type-checking'],
|
|
20
|
+
plugins: ['@typescript-eslint', 'import'],
|
|
21
|
+
rules: {
|
|
54
22
|
'@typescript-eslint/adjacent-overload-signatures': error,
|
|
55
23
|
'@typescript-eslint/ban-ts-comment': [
|
|
56
24
|
warn,
|
|
@@ -63,13 +31,29 @@ module.exports = {
|
|
|
63
31
|
},
|
|
64
32
|
],
|
|
65
33
|
'@typescript-eslint/ban-types': error,
|
|
34
|
+
'@typescript-eslint/brace-style': baseRules['brace-style'],
|
|
35
|
+
'@typescript-eslint/comma-dangle': [
|
|
36
|
+
baseRules['comma-dangle'][0],
|
|
37
|
+
{
|
|
38
|
+
...baseRules['comma-dangle'][1],
|
|
39
|
+
enums: baseRules['comma-dangle'][1].arrays,
|
|
40
|
+
generics: baseRules['comma-dangle'][1].arrays,
|
|
41
|
+
tuples: baseRules['comma-dangle'][1].arrays,
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
'@typescript-eslint/comma-spacing': baseRules['comma-spacing'],
|
|
66
45
|
'@typescript-eslint/consistent-type-assertions': [
|
|
67
46
|
error,
|
|
68
47
|
{ assertionStyle: 'as', objectLiteralTypeAssertions: 'never' },
|
|
69
48
|
],
|
|
49
|
+
'@typescript-eslint/default-param-last': baseRules['default-param-last'],
|
|
70
50
|
'@typescript-eslint/dot-notation': baseRules['dot-notation'],
|
|
71
51
|
'@typescript-eslint/explicit-function-return-type': off,
|
|
72
52
|
'@typescript-eslint/explicit-module-boundary-types': off,
|
|
53
|
+
'@typescript-eslint/func-call-spacing': baseRules['func-call-spacing'],
|
|
54
|
+
'@typescript-eslint/indent': baseRules.indent,
|
|
55
|
+
'@typescript-eslint/keyword-spacing': baseRules['keyword-spacing'],
|
|
56
|
+
'@typescript-eslint/lines-between-class-members': baseRules['lines-between-class-members'],
|
|
73
57
|
'@typescript-eslint/member-delimiter-style': error,
|
|
74
58
|
'@typescript-eslint/naming-convention': [
|
|
75
59
|
error,
|
|
@@ -96,28 +80,43 @@ module.exports = {
|
|
|
96
80
|
selector: 'typeLike',
|
|
97
81
|
},
|
|
98
82
|
],
|
|
99
|
-
'@typescript-eslint/no-array-constructor':
|
|
83
|
+
'@typescript-eslint/no-array-constructor': baseRules['no-array-constructor'],
|
|
100
84
|
'@typescript-eslint/no-base-to-string': error,
|
|
85
|
+
'@typescript-eslint/no-dupe-class-members': baseRules['no-dupe-class-members'],
|
|
101
86
|
'@typescript-eslint/no-empty-function': baseRules['no-empty-function'],
|
|
102
87
|
'@typescript-eslint/no-empty-interface': [error, { allowSingleExtends: true }],
|
|
103
88
|
'@typescript-eslint/no-explicit-any': off, // if any is explicit then it's wanted
|
|
89
|
+
'@typescript-eslint/no-extra-parens': baseRules['no-extra-parens'],
|
|
90
|
+
'@typescript-eslint/no-extra-semi': baseRules['no-extra-semi'],
|
|
104
91
|
'@typescript-eslint/no-implicit-any-catch': error,
|
|
105
92
|
'@typescript-eslint/no-inferrable-types': error,
|
|
93
|
+
'@typescript-eslint/no-loop-func': baseRules['no-loop-func'],
|
|
94
|
+
'@typescript-eslint/no-loss-of-precision': baseRules['no-loss-of-precision'],
|
|
95
|
+
'@typescript-eslint/no-magic-numbers': baseRules['no-magic-numbers'],
|
|
106
96
|
'@typescript-eslint/no-misused-new': error,
|
|
107
97
|
'@typescript-eslint/no-namespace': off, // We don't agree with community, namespaces are great and not deprecated
|
|
108
98
|
'@typescript-eslint/no-non-null-assertion': error,
|
|
109
|
-
'@typescript-eslint/no-redeclare': fixme(
|
|
99
|
+
'@typescript-eslint/no-redeclare': fixme(baseRules['no-redeclare']),
|
|
110
100
|
'@typescript-eslint/no-require-imports': error,
|
|
111
|
-
'@typescript-eslint/no-shadow': baseRules['no-shadow'],
|
|
101
|
+
'@typescript-eslint/no-shadow': baseRules['no-shadow'],
|
|
112
102
|
'@typescript-eslint/no-this-alias': error,
|
|
103
|
+
'@typescript-eslint/no-throw-literal': baseRules['no-throw-literal'],
|
|
113
104
|
'@typescript-eslint/no-unnecessary-condition': error,
|
|
114
105
|
'@typescript-eslint/no-unsafe-argument': error,
|
|
106
|
+
'@typescript-eslint/no-unused-expressions': baseRules['no-unused-expressions'],
|
|
115
107
|
'@typescript-eslint/no-unused-vars': baseRules['no-unused-vars'],
|
|
116
108
|
'@typescript-eslint/no-use-before-define': baseRules['no-use-before-define'],
|
|
117
109
|
'@typescript-eslint/no-useless-constructor': baseRules['no-useless-constructor'],
|
|
118
110
|
'@typescript-eslint/no-var-requires': error,
|
|
111
|
+
'@typescript-eslint/object-curly-spacing': baseRules['object-curly-spacing'],
|
|
119
112
|
'@typescript-eslint/prefer-namespace-keyword': error,
|
|
120
113
|
'@typescript-eslint/prefer-reduce-type-parameter': error,
|
|
114
|
+
'@typescript-eslint/quotes': baseRules.quotes,
|
|
115
|
+
'@typescript-eslint/require-await': baseRules['require-await'],
|
|
116
|
+
'@typescript-eslint/return-await': baseRules['no-return-await'],
|
|
117
|
+
'@typescript-eslint/semi': baseRules.semi,
|
|
118
|
+
'@typescript-eslint/space-before-function-paren': baseRules['space-before-function-paren'],
|
|
119
|
+
'@typescript-eslint/space-infix-ops': baseRules['space-infix-ops'],
|
|
121
120
|
'@typescript-eslint/strict-boolean-expressions': [
|
|
122
121
|
error,
|
|
123
122
|
{
|
|
@@ -130,6 +129,106 @@ module.exports = {
|
|
|
130
129
|
'@typescript-eslint/triple-slash-reference': error,
|
|
131
130
|
'@typescript-eslint/type-annotation-spacing': error,
|
|
132
131
|
},
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
132
|
+
},
|
|
133
|
+
/**
|
|
134
|
+
* Import overrides
|
|
135
|
+
*/
|
|
136
|
+
{
|
|
137
|
+
rules: {
|
|
138
|
+
'import/extensions': [
|
|
139
|
+
baseImportRules['import/extensions'][0],
|
|
140
|
+
baseImportRules['import/extensions'][1],
|
|
141
|
+
{
|
|
142
|
+
...baseImportRules['import/extensions'][2],
|
|
143
|
+
ts: 'never',
|
|
144
|
+
tsx: 'never',
|
|
145
|
+
},
|
|
146
|
+
],
|
|
147
|
+
'import/no-extraneous-dependencies': [
|
|
148
|
+
baseImportRules['import/no-extraneous-dependencies'][0],
|
|
149
|
+
{
|
|
150
|
+
...baseImportRules['import/no-extraneous-dependencies'][1],
|
|
151
|
+
devDependencies: baseImportRules['import/no-extraneous-dependencies'][1].devDependencies.reduce(
|
|
152
|
+
(/** @type {string[]} */ result, /** @type {string} */ devDep) => {
|
|
153
|
+
const toAppend = [devDep];
|
|
154
|
+
const devDepWithTs = devDep.replace(/\bjs(x?)\b/g, 'ts$1');
|
|
155
|
+
if (devDepWithTs !== devDep) {
|
|
156
|
+
toAppend.push(devDepWithTs);
|
|
157
|
+
}
|
|
158
|
+
return [...result, ...toAppend];
|
|
159
|
+
},
|
|
160
|
+
[]
|
|
161
|
+
),
|
|
162
|
+
},
|
|
163
|
+
],
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
/**
|
|
167
|
+
* Disabled rules
|
|
168
|
+
*/
|
|
169
|
+
{
|
|
170
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/docs/getting-started/linting/FAQ.md#eslint-plugin-import
|
|
171
|
+
rules: {
|
|
172
|
+
'brace-style': off,
|
|
173
|
+
camelcase: off,
|
|
174
|
+
'comma-dangle': off,
|
|
175
|
+
'comma-spacing': off,
|
|
176
|
+
'constructor-super': off,
|
|
177
|
+
'default-param-last': off,
|
|
178
|
+
'dot-notation': off,
|
|
179
|
+
'func-call-spacing': off,
|
|
180
|
+
'getter-return': off,
|
|
181
|
+
'import/default': duplicateTSC,
|
|
182
|
+
'import/export': fixme(error), // https://github.com/benmosher/eslint-plugin-import/issues/1964
|
|
183
|
+
'import/named': duplicateTSC,
|
|
184
|
+
'import/namespace': duplicateTSC,
|
|
185
|
+
'import/no-named-as-default-member': duplicateTSC,
|
|
186
|
+
'import/no-unresolved': duplicateTSC,
|
|
187
|
+
indent: off,
|
|
188
|
+
'keyword-spacing': off,
|
|
189
|
+
'lines-between-class-members': off,
|
|
190
|
+
'no-array-constructor': off,
|
|
191
|
+
'no-const-assign': off,
|
|
192
|
+
'no-dupe-args': off,
|
|
193
|
+
'no-dupe-class-members': off,
|
|
194
|
+
'no-dupe-keys': off,
|
|
195
|
+
'no-empty-function': off,
|
|
196
|
+
'no-extra-parens': off,
|
|
197
|
+
'no-extra-semi': off,
|
|
198
|
+
'no-func-assign': off,
|
|
199
|
+
'no-implied-eval': off,
|
|
200
|
+
'no-import-assign': off,
|
|
201
|
+
'no-inner-declarations': fixme(error), // https://github.com/typescript-eslint/typescript-eslint/issues/239
|
|
202
|
+
'no-loop-func': off,
|
|
203
|
+
'no-loss-of-precision': off,
|
|
204
|
+
'no-magic-numbers': off,
|
|
205
|
+
'no-new-func': off,
|
|
206
|
+
'no-new-symbol': off,
|
|
207
|
+
'no-obj-calls': off,
|
|
208
|
+
'no-redeclare': off,
|
|
209
|
+
'no-return-await': off,
|
|
210
|
+
'no-setter-return': off,
|
|
211
|
+
'no-shadow': off,
|
|
212
|
+
'no-this-before-super': off,
|
|
213
|
+
'no-throw-literal': off,
|
|
214
|
+
'no-undef': off,
|
|
215
|
+
'no-unreachable': off,
|
|
216
|
+
'no-unsafe-negation': off,
|
|
217
|
+
'no-unused-expression': off,
|
|
218
|
+
'no-unused-vars': off,
|
|
219
|
+
'no-use-before-define': off,
|
|
220
|
+
'no-useless-constructor': off,
|
|
221
|
+
'no-var': error,
|
|
222
|
+
'object-curly-spacing': off,
|
|
223
|
+
'prefer-const': error,
|
|
224
|
+
'prefer-rest-params': error,
|
|
225
|
+
'prefer-spread': error,
|
|
226
|
+
quotes: off,
|
|
227
|
+
'require-await': off,
|
|
228
|
+
semi: off,
|
|
229
|
+
'space-before-function-paren': off,
|
|
230
|
+
'space-infix-ops': off,
|
|
231
|
+
'valid-typeof': off,
|
|
232
|
+
},
|
|
233
|
+
}
|
|
234
|
+
);
|
package/rules/unicorn.js
CHANGED
|
@@ -1,18 +1,10 @@
|
|
|
1
|
-
const { off, warn, error } = require('./_rule');
|
|
1
|
+
const { off, warn, error, concatESConfig } = require('./_rule');
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
'unicorn/prevent-abbreviations': off, // This rule is so dangerous : it potentially break code while fixing in many cases !!
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
module.exports = {
|
|
12
|
-
extends: ['plugin:unicorn/recommended'],
|
|
13
|
-
plugins: ['unicorn'],
|
|
14
|
-
rules: Object.assign(
|
|
15
|
-
{
|
|
3
|
+
module.exports = concatESConfig(
|
|
4
|
+
{
|
|
5
|
+
extends: ['plugin:unicorn/recommended'],
|
|
6
|
+
plugins: ['unicorn'],
|
|
7
|
+
rules: {
|
|
16
8
|
'unicode-bom': [error, 'never'],
|
|
17
9
|
'unicorn/better-regex': error,
|
|
18
10
|
'unicorn/catch-error-name': [error, { name: error }],
|
|
@@ -53,6 +45,14 @@ module.exports = {
|
|
|
53
45
|
'unicorn/prefer-type-error': error,
|
|
54
46
|
'unicorn/throw-new-error': error,
|
|
55
47
|
},
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
rules: {
|
|
51
|
+
'unicorn/consistent-destructuring': off,
|
|
52
|
+
'unicorn/no-array-for-each': off, // This rule could change browser compatibility
|
|
53
|
+
'unicorn/no-object-as-default-parameter': off,
|
|
54
|
+
'unicorn/prefer-default-parameters': off,
|
|
55
|
+
'unicorn/prevent-abbreviations': off, // This rule is so dangerous : it potentially break code while fixing in many cases !!
|
|
56
|
+
},
|
|
57
|
+
}
|
|
58
|
+
);
|
package/ts.js
CHANGED
|
@@ -14,4 +14,23 @@ module.exports = {
|
|
|
14
14
|
parserOptions: {
|
|
15
15
|
sourceType: 'module',
|
|
16
16
|
},
|
|
17
|
+
settings: {
|
|
18
|
+
// Append 'ts' extensions to Airbnb 'import/extensions' setting
|
|
19
|
+
'import/extensions': ['.js', '.mjs', '.jsx', '.ts', '.tsx', '.d.ts'],
|
|
20
|
+
|
|
21
|
+
// Resolve type definition packages
|
|
22
|
+
'import/external-module-folders': ['node_modules', 'node_modules/@types'],
|
|
23
|
+
|
|
24
|
+
// Apply special parsing for TypeScript files
|
|
25
|
+
'import/parsers': {
|
|
26
|
+
'@typescript-eslint/parser': ['.ts', '.tsx', '.d.ts'],
|
|
27
|
+
},
|
|
28
|
+
|
|
29
|
+
// Append 'ts' extensions to Airbnb 'import/resolver' setting
|
|
30
|
+
'import/resolver': {
|
|
31
|
+
node: {
|
|
32
|
+
extensions: ['.mjs', '.js', '.json', '.ts', '.d.ts'],
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
},
|
|
17
36
|
};
|