@w5s/eslint-config 2.4.5 → 3.0.1
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/dist/index.d.ts +8054 -3
- package/dist/index.js +4171 -22
- package/dist/index.js.map +1 -0
- package/package.json +26 -17
- package/src/config/createRules.ts +5 -0
- package/src/config/es.ts +58 -0
- package/src/config/ignores.ts +84 -0
- package/src/config/imports.ts +32 -0
- package/src/config/jsdoc.ts +53 -0
- package/src/config/jsonc.ts +237 -0
- package/src/config/node.ts +42 -0
- package/src/config/stylistic.ts +50 -0
- package/src/config/test.ts +44 -0
- package/src/config/ts.ts +97 -0
- package/src/config/unicorn.ts +68 -0
- package/src/config/yml.ts +70 -0
- package/src/config.ts +11 -0
- package/src/defineConfig.ts +62 -0
- package/src/index.ts +3 -31
- package/src/type/Config.ts +5 -0
- package/src/type/PluginOptionsBase.ts +14 -0
- package/src/type/StylisticConfig.ts +39 -0
- package/src/type.ts +3 -0
- package/src/typegen/.keep +0 -0
- package/src/typegen/import.d.ts +501 -0
- package/src/typegen/jsdoc.d.ts +1155 -0
- package/src/typegen/jsonc.d.ts +500 -0
- package/src/typegen/node.d.ts +529 -0
- package/src/typegen/style.d.ts +1637 -0
- package/src/typegen/test.d.ts +430 -0
- package/src/typegen/ts.d.ts +1872 -0
- package/src/typegen/unicorn.d.ts +913 -0
- package/src/typegen/yml.d.ts +363 -0
- package/dist/es.d.ts +0 -3
- package/dist/es.js +0 -10
- package/dist/jest.d.ts +0 -3
- package/dist/jest.js +0 -20
- package/dist/json.d.ts +0 -3
- package/dist/json.js +0 -14
- package/dist/rules/es/base.d.ts +0 -4
- package/dist/rules/es/base.js +0 -71
- package/dist/rules/es/import.d.ts +0 -3
- package/dist/rules/es/import.js +0 -74
- package/dist/rules/es/jsdoc.d.ts +0 -3
- package/dist/rules/es/jsdoc.js +0 -21
- package/dist/rules/es/node.d.ts +0 -3
- package/dist/rules/es/node.js +0 -20
- package/dist/rules/es/promise.d.ts +0 -3
- package/dist/rules/es/promise.js +0 -11
- package/dist/rules/es/unicorn.d.ts +0 -3
- package/dist/rules/es/unicorn.js +0 -72
- package/dist/rules/es.d.ts +0 -3
- package/dist/rules/es.js +0 -14
- package/dist/rules/ignore.d.ts +0 -3
- package/dist/rules/ignore.js +0 -54
- package/dist/rules/jest.d.ts +0 -3
- package/dist/rules/jest.js +0 -64
- package/dist/rules/jsonc.d.ts +0 -3
- package/dist/rules/jsonc.js +0 -183
- package/dist/rules/prettier.d.ts +0 -3
- package/dist/rules/prettier.js +0 -13
- package/dist/rules/typescript.d.ts +0 -3
- package/dist/rules/typescript.js +0 -249
- package/dist/rules/yml.d.ts +0 -3
- package/dist/rules/yml.js +0 -21
- package/dist/tsconfig.build.tsbuildinfo +0 -1
- package/dist/typescript.d.ts +0 -3
- package/dist/typescript.js +0 -21
- package/dist/yml.d.ts +0 -3
- package/dist/yml.js +0 -19
- package/src/es.ts +0 -12
- package/src/jest.ts +0 -18
- package/src/json.ts +0 -12
- package/src/rules/es/base.ts +0 -83
- package/src/rules/es/import.ts +0 -81
- package/src/rules/es/jsdoc.ts +0 -23
- package/src/rules/es/node.ts +0 -21
- package/src/rules/es/promise.ts +0 -12
- package/src/rules/es/unicorn.ts +0 -74
- package/src/rules/es.ts +0 -21
- package/src/rules/ignore.ts +0 -54
- package/src/rules/jest.ts +0 -68
- package/src/rules/jsonc.ts +0 -187
- package/src/rules/prettier.ts +0 -11
- package/src/rules/typescript.ts +0 -255
- package/src/rules/yml.ts +0 -22
- package/src/typescript.ts +0 -24
- package/src/yml.ts +0 -18
package/dist/rules/typescript.js
DELETED
|
@@ -1,249 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
const dev_1 = require("@w5s/dev");
|
|
6
|
-
const base_js_1 = __importDefault(require("./es/base.js"));
|
|
7
|
-
const import_js_1 = __importDefault(require("./es/import.js"));
|
|
8
|
-
// Inspired by https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
|
|
9
|
-
// Fix Hack : TS plugin seems to modify the rules
|
|
10
|
-
const deepClone = (anyValue) => structuredClone(anyValue);
|
|
11
|
-
const baseRules = deepClone(base_js_1.default.rules) ?? {};
|
|
12
|
-
const baseImportRules = deepClone(import_js_1.default.rules) ?? {};
|
|
13
|
-
const duplicateTSC = 'off'; // = "off because tsc already checks that"
|
|
14
|
-
const config = dev_1.ESLintConfig.concat(
|
|
15
|
-
/**
|
|
16
|
-
* Plugin rules
|
|
17
|
-
*/
|
|
18
|
-
{
|
|
19
|
-
extends: ['plugin:@typescript-eslint/recommended-requiring-type-checking'],
|
|
20
|
-
parser: '@typescript-eslint/parser',
|
|
21
|
-
parserOptions: {
|
|
22
|
-
sourceType: 'module',
|
|
23
|
-
},
|
|
24
|
-
plugins: ['@typescript-eslint', 'import'],
|
|
25
|
-
rules: {
|
|
26
|
-
'@typescript-eslint/adjacent-overload-signatures': 'error',
|
|
27
|
-
'@typescript-eslint/ban-ts-comment': [
|
|
28
|
-
'warn',
|
|
29
|
-
{
|
|
30
|
-
minimumDescriptionLength: 3,
|
|
31
|
-
'ts-check': false,
|
|
32
|
-
'ts-expect-error': 'allow-with-description',
|
|
33
|
-
'ts-ignore': 'allow-with-description',
|
|
34
|
-
'ts-nocheck': true,
|
|
35
|
-
},
|
|
36
|
-
],
|
|
37
|
-
'@typescript-eslint/brace-style': baseRules['brace-style'],
|
|
38
|
-
'@typescript-eslint/comma-dangle': [
|
|
39
|
-
baseRules['comma-dangle'][0],
|
|
40
|
-
{
|
|
41
|
-
...baseRules['comma-dangle'][1],
|
|
42
|
-
enums: baseRules['comma-dangle'][1].arrays,
|
|
43
|
-
generics: baseRules['comma-dangle'][1].arrays,
|
|
44
|
-
tuples: baseRules['comma-dangle'][1].arrays,
|
|
45
|
-
},
|
|
46
|
-
],
|
|
47
|
-
'@typescript-eslint/comma-spacing': baseRules['comma-spacing'],
|
|
48
|
-
'@typescript-eslint/consistent-type-assertions': [
|
|
49
|
-
'error',
|
|
50
|
-
{ assertionStyle: 'as', objectLiteralTypeAssertions: 'never' },
|
|
51
|
-
],
|
|
52
|
-
'@typescript-eslint/default-param-last': baseRules['default-param-last'],
|
|
53
|
-
'@typescript-eslint/dot-notation': baseRules['dot-notation'],
|
|
54
|
-
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
55
|
-
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
56
|
-
'@typescript-eslint/func-call-spacing': baseRules['func-call-spacing'],
|
|
57
|
-
'@typescript-eslint/indent': baseRules.indent,
|
|
58
|
-
'@typescript-eslint/keyword-spacing': baseRules['keyword-spacing'],
|
|
59
|
-
// '@typescript-eslint/lines-between-class-members': baseRules['lines-between-class-members'],
|
|
60
|
-
'@typescript-eslint/member-delimiter-style': 'error',
|
|
61
|
-
'@typescript-eslint/naming-convention': [
|
|
62
|
-
'error',
|
|
63
|
-
{
|
|
64
|
-
format: ['PascalCase', 'camelCase'],
|
|
65
|
-
leadingUnderscore: 'allow',
|
|
66
|
-
selector: 'default',
|
|
67
|
-
trailingUnderscore: 'allow',
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
format: ['PascalCase', 'camelCase', 'UPPER_CASE'],
|
|
71
|
-
leadingUnderscore: 'allow',
|
|
72
|
-
selector: 'variable',
|
|
73
|
-
trailingUnderscore: 'allow',
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
format: ['PascalCase', 'camelCase', 'UPPER_CASE'],
|
|
77
|
-
leadingUnderscore: 'allowSingleOrDouble',
|
|
78
|
-
selector: 'memberLike',
|
|
79
|
-
trailingUnderscore: 'allowDouble',
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
format: ['PascalCase'],
|
|
83
|
-
selector: 'typeLike',
|
|
84
|
-
},
|
|
85
|
-
],
|
|
86
|
-
'@typescript-eslint/no-array-constructor': baseRules['no-array-constructor'],
|
|
87
|
-
'@typescript-eslint/no-base-to-string': 'error',
|
|
88
|
-
'@typescript-eslint/no-dupe-class-members': baseRules['no-dupe-class-members'],
|
|
89
|
-
'@typescript-eslint/no-empty-function': baseRules['no-empty-function'],
|
|
90
|
-
'@typescript-eslint/no-empty-interface': ['error', { allowSingleExtends: true }],
|
|
91
|
-
'@typescript-eslint/no-empty-object-type': 'off',
|
|
92
|
-
'@typescript-eslint/no-explicit-any': 'off', // if any is explicit then it's wanted
|
|
93
|
-
'@typescript-eslint/no-extra-parens': baseRules['no-extra-parens'],
|
|
94
|
-
'@typescript-eslint/no-extra-semi': baseRules['no-extra-semi'],
|
|
95
|
-
'@typescript-eslint/no-inferrable-types': 'error',
|
|
96
|
-
'@typescript-eslint/no-loop-func': baseRules['no-loop-func'],
|
|
97
|
-
'@typescript-eslint/no-loss-of-precision': baseRules['no-loss-of-precision'],
|
|
98
|
-
'@typescript-eslint/no-magic-numbers': baseRules['no-magic-numbers'],
|
|
99
|
-
'@typescript-eslint/no-misused-new': 'error',
|
|
100
|
-
'@typescript-eslint/no-namespace': 'off', // We don't agree with community, namespaces are great and not deprecated
|
|
101
|
-
'@typescript-eslint/no-non-null-assertion': 'error',
|
|
102
|
-
'@typescript-eslint/no-redeclare': dev_1.ESLintConfig.fixme(baseRules['no-redeclare']),
|
|
103
|
-
'@typescript-eslint/no-require-imports': 'error',
|
|
104
|
-
'@typescript-eslint/no-shadow': baseRules['no-shadow'],
|
|
105
|
-
'@typescript-eslint/no-this-alias': 'error',
|
|
106
|
-
'@typescript-eslint/no-unnecessary-condition': 'error',
|
|
107
|
-
'@typescript-eslint/no-unsafe-argument': 'error',
|
|
108
|
-
'@typescript-eslint/no-unused-expressions': baseRules['no-unused-expressions'],
|
|
109
|
-
'@typescript-eslint/no-unused-vars': baseRules['no-unused-vars'],
|
|
110
|
-
'@typescript-eslint/no-use-before-define': baseRules['no-use-before-define'],
|
|
111
|
-
'@typescript-eslint/no-useless-constructor': baseRules['no-useless-constructor'],
|
|
112
|
-
'@typescript-eslint/no-var-requires': 'error',
|
|
113
|
-
'@typescript-eslint/no-wrapper-object-types': 'error',
|
|
114
|
-
'@typescript-eslint/object-curly-spacing': baseRules['object-curly-spacing'],
|
|
115
|
-
// '@typescript-eslint/no-throw-literal': baseRules['no-throw-literal'],
|
|
116
|
-
'@typescript-eslint/only-throw-error': baseRules['no-throw-literal'],
|
|
117
|
-
'@typescript-eslint/prefer-namespace-keyword': 'error',
|
|
118
|
-
'@typescript-eslint/prefer-reduce-type-parameter': 'error',
|
|
119
|
-
'@typescript-eslint/quotes': baseRules.quotes,
|
|
120
|
-
'@typescript-eslint/require-await': baseRules['require-await'],
|
|
121
|
-
'@typescript-eslint/return-await': baseRules['no-return-await'],
|
|
122
|
-
'@typescript-eslint/semi': baseRules.semi,
|
|
123
|
-
'@typescript-eslint/space-before-function-paren': baseRules['space-before-function-paren'],
|
|
124
|
-
'@typescript-eslint/space-infix-ops': baseRules['space-infix-ops'],
|
|
125
|
-
'@typescript-eslint/strict-boolean-expressions': [
|
|
126
|
-
'error',
|
|
127
|
-
{
|
|
128
|
-
allowNullableObject: false,
|
|
129
|
-
allowNumber: false,
|
|
130
|
-
allowString: false,
|
|
131
|
-
},
|
|
132
|
-
],
|
|
133
|
-
'@typescript-eslint/switch-exhaustiveness-check': 'error',
|
|
134
|
-
'@typescript-eslint/triple-slash-reference': 'error',
|
|
135
|
-
'@typescript-eslint/type-annotation-spacing': 'error',
|
|
136
|
-
},
|
|
137
|
-
},
|
|
138
|
-
/**
|
|
139
|
-
* JSDoc overrides
|
|
140
|
-
*/
|
|
141
|
-
{
|
|
142
|
-
rules: {
|
|
143
|
-
'jsdoc/no-types': 'error',
|
|
144
|
-
'jsdoc/require-param': 'off',
|
|
145
|
-
'jsdoc/require-param-type': 'off',
|
|
146
|
-
'jsdoc/require-returns': 'off',
|
|
147
|
-
'jsdoc/require-returns-type': 'off',
|
|
148
|
-
},
|
|
149
|
-
},
|
|
150
|
-
/**
|
|
151
|
-
* Import overrides
|
|
152
|
-
*/
|
|
153
|
-
{
|
|
154
|
-
rules: {
|
|
155
|
-
'import/extensions': [
|
|
156
|
-
baseImportRules['import/extensions'][0],
|
|
157
|
-
baseImportRules['import/extensions'][1],
|
|
158
|
-
{
|
|
159
|
-
...baseImportRules['import/extensions'][2],
|
|
160
|
-
// ts: 'never',
|
|
161
|
-
// tsx: 'never',
|
|
162
|
-
},
|
|
163
|
-
],
|
|
164
|
-
'import/no-extraneous-dependencies': [
|
|
165
|
-
baseImportRules['import/no-extraneous-dependencies'][0],
|
|
166
|
-
{
|
|
167
|
-
...baseImportRules['import/no-extraneous-dependencies'][1],
|
|
168
|
-
devDependencies: baseImportRules['import/no-extraneous-dependencies'][1].devDependencies.reduce((result, devDep) => {
|
|
169
|
-
const toAppend = [devDep];
|
|
170
|
-
// eslint-disable-next-line unicorn/prefer-string-replace-all
|
|
171
|
-
const devDepWithTs = devDep.replace(/\bjs(x?)\b/g, 'ts$1');
|
|
172
|
-
if (devDepWithTs !== devDep) {
|
|
173
|
-
toAppend.push(devDepWithTs);
|
|
174
|
-
}
|
|
175
|
-
return [...result, ...toAppend];
|
|
176
|
-
}, []),
|
|
177
|
-
},
|
|
178
|
-
],
|
|
179
|
-
},
|
|
180
|
-
},
|
|
181
|
-
/**
|
|
182
|
-
* Disabled rules
|
|
183
|
-
*/
|
|
184
|
-
{
|
|
185
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/docs/getting-started/linting/FAQ.md#eslint-plugin-import
|
|
186
|
-
rules: {
|
|
187
|
-
'brace-style': 'off',
|
|
188
|
-
camelcase: 'off',
|
|
189
|
-
'comma-dangle': 'off',
|
|
190
|
-
'comma-spacing': 'off',
|
|
191
|
-
'constructor-super': 'off',
|
|
192
|
-
'default-param-last': 'off',
|
|
193
|
-
'dot-notation': 'off',
|
|
194
|
-
'func-call-spacing': 'off',
|
|
195
|
-
'getter-return': 'off',
|
|
196
|
-
'import/default': duplicateTSC,
|
|
197
|
-
'import/export': dev_1.ESLintConfig.fixme('error'), // https://github.com/benmosher/eslint-plugin-import/issues/1964
|
|
198
|
-
'import/named': duplicateTSC,
|
|
199
|
-
'import/namespace': duplicateTSC,
|
|
200
|
-
'import/no-named-as-default-member': duplicateTSC,
|
|
201
|
-
'import/no-unresolved': duplicateTSC,
|
|
202
|
-
indent: 'off',
|
|
203
|
-
'keyword-spacing': 'off',
|
|
204
|
-
'lines-between-class-members': 'off',
|
|
205
|
-
'no-array-constructor': 'off',
|
|
206
|
-
'no-const-assign': 'off',
|
|
207
|
-
'no-dupe-args': 'off',
|
|
208
|
-
'no-dupe-class-members': 'off',
|
|
209
|
-
'no-dupe-keys': 'off',
|
|
210
|
-
'no-empty-function': 'off',
|
|
211
|
-
'no-extra-parens': 'off',
|
|
212
|
-
'no-extra-semi': 'off',
|
|
213
|
-
'no-func-assign': 'off',
|
|
214
|
-
'no-implied-eval': 'off',
|
|
215
|
-
'no-import-assign': 'off',
|
|
216
|
-
'no-inner-declarations': dev_1.ESLintConfig.fixme('error'), // https://github.com/typescript-eslint/typescript-eslint/issues/239
|
|
217
|
-
'no-loop-func': 'off',
|
|
218
|
-
'no-loss-of-precision': 'off',
|
|
219
|
-
'no-magic-numbers': 'off',
|
|
220
|
-
'no-new-func': 'off',
|
|
221
|
-
'no-new-symbol': 'off',
|
|
222
|
-
'no-obj-calls': 'off',
|
|
223
|
-
'no-redeclare': 'off',
|
|
224
|
-
'no-return-await': 'off',
|
|
225
|
-
'no-setter-return': 'off',
|
|
226
|
-
'no-shadow': 'off',
|
|
227
|
-
'no-this-before-super': 'off',
|
|
228
|
-
'no-throw-literal': 'off',
|
|
229
|
-
'no-undef': 'off',
|
|
230
|
-
'no-unreachable': 'off',
|
|
231
|
-
'no-unsafe-negation': 'off',
|
|
232
|
-
'no-unused-expressions': 'off',
|
|
233
|
-
'no-unused-vars': 'off',
|
|
234
|
-
'no-use-before-define': 'off',
|
|
235
|
-
'no-useless-constructor': 'off',
|
|
236
|
-
'no-var': 'error',
|
|
237
|
-
'object-curly-spacing': 'off',
|
|
238
|
-
'prefer-const': 'error',
|
|
239
|
-
'prefer-rest-params': 'error',
|
|
240
|
-
'prefer-spread': 'error',
|
|
241
|
-
quotes: 'off',
|
|
242
|
-
'require-await': 'off',
|
|
243
|
-
semi: 'off',
|
|
244
|
-
'space-before-function-paren': 'off',
|
|
245
|
-
'space-infix-ops': 'off',
|
|
246
|
-
'valid-typeof': 'off',
|
|
247
|
-
},
|
|
248
|
-
});
|
|
249
|
-
module.exports = config;
|
package/dist/rules/yml.d.ts
DELETED
package/dist/rules/yml.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
const dev_1 = require("@w5s/dev");
|
|
3
|
-
const yamlExtensions = dev_1.Project.queryExtensions(['yaml']);
|
|
4
|
-
const config = {
|
|
5
|
-
extends: ['plugin:yml/standard', 'plugin:yml/prettier'],
|
|
6
|
-
overrides: [
|
|
7
|
-
{
|
|
8
|
-
files: [
|
|
9
|
-
...yamlExtensions.map((ext) => `docker-compose*${ext}`),
|
|
10
|
-
...yamlExtensions.map((ext) => `compose-*${ext}`),
|
|
11
|
-
...yamlExtensions.map((ext) => `compose${ext}`),
|
|
12
|
-
],
|
|
13
|
-
rules: {
|
|
14
|
-
'yml/no-empty-mapping-value': 'off',
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
],
|
|
18
|
-
parser: 'yaml-eslint-parser',
|
|
19
|
-
plugins: ['yml'],
|
|
20
|
-
};
|
|
21
|
-
module.exports = config;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"root":["../src/es.ts","../src/index.ts","../src/jest.ts","../src/json.ts","../src/typescript.ts","../src/yml.ts","../src/rules/es.ts","../src/rules/ignore.ts","../src/rules/jest.ts","../src/rules/jsonc.ts","../src/rules/prettier.ts","../src/rules/typescript.ts","../src/rules/yml.ts","../src/rules/es/base.ts","../src/rules/es/import.ts","../src/rules/es/jsdoc.ts","../src/rules/es/node.ts","../src/rules/es/promise.ts","../src/rules/es/unicorn.ts"],"version":"5.9.2"}
|
package/dist/typescript.d.ts
DELETED
package/dist/typescript.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
const dev_1 = require("@w5s/dev");
|
|
6
|
-
const prettier_js_1 = __importDefault(require("./rules/prettier.js"));
|
|
7
|
-
const config = {
|
|
8
|
-
overrides: [
|
|
9
|
-
{
|
|
10
|
-
...dev_1.ESLintConfig.concat({
|
|
11
|
-
extends: [require.resolve('./rules/typescript.js')],
|
|
12
|
-
}, prettier_js_1.default),
|
|
13
|
-
files: [
|
|
14
|
-
dev_1.Project.extensionsToGlob(
|
|
15
|
-
// ts only extensions
|
|
16
|
-
dev_1.Project.queryExtensions(['typescript', 'typescriptreact'])),
|
|
17
|
-
],
|
|
18
|
-
},
|
|
19
|
-
],
|
|
20
|
-
};
|
|
21
|
-
module.exports = config;
|
package/dist/yml.d.ts
DELETED
package/dist/yml.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
const dev_1 = require("@w5s/dev");
|
|
6
|
-
const yml_js_1 = __importDefault(require("./rules/yml.js"));
|
|
7
|
-
const config = {
|
|
8
|
-
overrides: [
|
|
9
|
-
{
|
|
10
|
-
...yml_js_1.default,
|
|
11
|
-
files: [
|
|
12
|
-
dev_1.Project.extensionsToGlob(
|
|
13
|
-
// ts only extensions
|
|
14
|
-
dev_1.Project.queryExtensions(['yaml'])),
|
|
15
|
-
],
|
|
16
|
-
},
|
|
17
|
-
],
|
|
18
|
-
};
|
|
19
|
-
module.exports = config;
|
package/src/es.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type eslint from 'eslint';
|
|
2
|
-
import { ESLintConfig } from '@w5s/dev';
|
|
3
|
-
import prettierConfig from './rules/prettier.js';
|
|
4
|
-
|
|
5
|
-
const config: eslint.Linter.Config = ESLintConfig.concat(
|
|
6
|
-
{
|
|
7
|
-
extends: [require.resolve('./rules/es.js')],
|
|
8
|
-
},
|
|
9
|
-
prettierConfig,
|
|
10
|
-
);
|
|
11
|
-
|
|
12
|
-
export = config;
|
package/src/jest.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type eslint from 'eslint';
|
|
2
|
-
import { Project } from '@w5s/dev';
|
|
3
|
-
import jestConfig from './rules/jest.js';
|
|
4
|
-
|
|
5
|
-
const sourceGlob = Project.extensionsToGlob(Project.sourceExtensions());
|
|
6
|
-
const config: eslint.Linter.Config = {
|
|
7
|
-
overrides: [
|
|
8
|
-
{
|
|
9
|
-
...jestConfig,
|
|
10
|
-
files: [
|
|
11
|
-
`**/__mocks__/**/${sourceGlob}`,
|
|
12
|
-
`**/__tests__/**/${sourceGlob}`,
|
|
13
|
-
`**/?(*.)+(spec|test)${sourceGlob.slice(1)}`,
|
|
14
|
-
],
|
|
15
|
-
},
|
|
16
|
-
],
|
|
17
|
-
};
|
|
18
|
-
export = config;
|
package/src/json.ts
DELETED
package/src/rules/es/base.ts
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import type eslint from 'eslint';
|
|
2
|
-
import { Project, ESLintConfig } from '@w5s/dev';
|
|
3
|
-
|
|
4
|
-
// Fix eslint shareable config (https://github.com/eslint/eslint/issues/3458)
|
|
5
|
-
// @ts-ignore No typing available
|
|
6
|
-
import '@rushstack/eslint-patch/modern-module-resolution.js';
|
|
7
|
-
// @ts-ignore No typing available
|
|
8
|
-
import bestPracticesConfig from 'eslint-config-airbnb-base/rules/best-practices';
|
|
9
|
-
// @ts-ignore No typing available
|
|
10
|
-
import errorsConfig from 'eslint-config-airbnb-base/rules/errors';
|
|
11
|
-
// @ts-ignore No typing available
|
|
12
|
-
import es6Config from 'eslint-config-airbnb-base/rules/es6';
|
|
13
|
-
// @ts-ignore No typing available
|
|
14
|
-
import nodeConfig from 'eslint-config-airbnb-base/rules/node';
|
|
15
|
-
// @ts-ignore No typing available
|
|
16
|
-
import strictConfig from 'eslint-config-airbnb-base/rules/strict';
|
|
17
|
-
// @ts-ignore No typing available
|
|
18
|
-
import styleConfig from 'eslint-config-airbnb-base/rules/style';
|
|
19
|
-
// @ts-ignore No typing available
|
|
20
|
-
import variablesConfig from 'eslint-config-airbnb-base/rules/variables';
|
|
21
|
-
|
|
22
|
-
const baseConfig = ESLintConfig.concat(
|
|
23
|
-
bestPracticesConfig,
|
|
24
|
-
errorsConfig,
|
|
25
|
-
es6Config,
|
|
26
|
-
nodeConfig,
|
|
27
|
-
strictConfig,
|
|
28
|
-
styleConfig,
|
|
29
|
-
variablesConfig,
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
const config: eslint.Linter.Config = ESLintConfig.concat(
|
|
33
|
-
baseConfig,
|
|
34
|
-
// overrides
|
|
35
|
-
{
|
|
36
|
-
env: {
|
|
37
|
-
[`es${Project.ecmaVersion()}`]: true,
|
|
38
|
-
},
|
|
39
|
-
globals: {
|
|
40
|
-
__DEV__: 'readonly',
|
|
41
|
-
__PROD__: 'readonly',
|
|
42
|
-
__TEST__: 'readonly',
|
|
43
|
-
},
|
|
44
|
-
parser: 'espree',
|
|
45
|
-
parserOptions: {
|
|
46
|
-
ecmaFeatures: {
|
|
47
|
-
jsx: true,
|
|
48
|
-
},
|
|
49
|
-
ecmaVersion: Project.ecmaVersion(),
|
|
50
|
-
sourceType: 'module',
|
|
51
|
-
},
|
|
52
|
-
reportUnusedDisableDirectives: true,
|
|
53
|
-
rules: {
|
|
54
|
-
// Too many errors in components
|
|
55
|
-
'class-methods-use-this': 'off',
|
|
56
|
-
// Annoying because it is not always wanted
|
|
57
|
-
'default-case': 'off',
|
|
58
|
-
// We do not want console.* in production. Disable this rule on a per line basis if needed
|
|
59
|
-
'no-console': 'error',
|
|
60
|
-
// Often useful in jsx
|
|
61
|
-
'no-nested-ternary': 'off',
|
|
62
|
-
// Too strict, for pure code prefer the functional plugin
|
|
63
|
-
'no-param-reassign': ['error', { props: false }],
|
|
64
|
-
// Allow for-of syntax
|
|
65
|
-
// @ts-ignore No typing available
|
|
66
|
-
'no-restricted-syntax': baseConfig.rules['no-restricted-syntax'].filter(
|
|
67
|
-
// @ts-ignore No typing available
|
|
68
|
-
({ selector }) => selector !== 'ForOfStatement',
|
|
69
|
-
),
|
|
70
|
-
// underscore is often used (mongodb, etc)
|
|
71
|
-
'no-underscore-dangle': 'off',
|
|
72
|
-
// Ignore underscore case arguments
|
|
73
|
-
'no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
|
|
74
|
-
// Allow in some cases https://github.com/airbnb/javascript/issues/1089#issuecomment-1024351821
|
|
75
|
-
'no-use-before-define': ['error', 'nofunc'],
|
|
76
|
-
// Allow statements, to be compatible with '@typescript-eslint/no-floating-promises' fix
|
|
77
|
-
'no-void': ['error', { allowAsStatement: true }],
|
|
78
|
-
'unicode-bom': ['error', 'never'],
|
|
79
|
-
},
|
|
80
|
-
},
|
|
81
|
-
);
|
|
82
|
-
|
|
83
|
-
export = config;
|
package/src/rules/es/import.ts
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { ESLintConfig, Project } from '@w5s/dev';
|
|
2
|
-
import type eslint from 'eslint';
|
|
3
|
-
// @ts-ignore airbnb is not typed
|
|
4
|
-
import importConfig from 'eslint-config-airbnb-base/rules/imports';
|
|
5
|
-
|
|
6
|
-
// @see https://github.com/typescript-eslint/typescript-eslint/blob/master/docs/getting-started/linting/FAQ.md#eslint-plugin-import
|
|
7
|
-
|
|
8
|
-
const extensionsToMatcher = (extensions: readonly Project.Extension[]): string =>
|
|
9
|
-
`.{${extensions.map((_) => _.slice(1)).join(',')}}`;
|
|
10
|
-
const configFiles = [
|
|
11
|
-
// plopfile.js, plopfile.cjs, plopfile.mts, plopfile.ts, ...
|
|
12
|
-
`plopfile${extensionsToMatcher(Project.queryExtensions(['javascript', 'typescript']))}`,
|
|
13
|
-
// dangerfile.js, dangerfile.cjs, dangerfile.mts, dangerfile.ts, ...
|
|
14
|
-
`dangerfile${extensionsToMatcher(Project.queryExtensions(['javascript', 'typescript']))}`,
|
|
15
|
-
// *.config.js, *.config.cjs, *.config.mts, *.config.ts, ...
|
|
16
|
-
`**/*.config${extensionsToMatcher(Project.queryExtensions(['javascript', 'typescript']))}`,
|
|
17
|
-
];
|
|
18
|
-
|
|
19
|
-
const config: eslint.Linter.Config = ESLintConfig.concat(
|
|
20
|
-
importConfig,
|
|
21
|
-
// Overrides
|
|
22
|
-
{
|
|
23
|
-
rules: {
|
|
24
|
-
'import/extensions': [
|
|
25
|
-
'error',
|
|
26
|
-
'ignorePackages',
|
|
27
|
-
{
|
|
28
|
-
// js: 'never',
|
|
29
|
-
// jsx: 'never',
|
|
30
|
-
// mjs: 'never',
|
|
31
|
-
},
|
|
32
|
-
],
|
|
33
|
-
'import/no-default-export': 'error', // Default exports are bad, especially when refactoring/renaming module
|
|
34
|
-
'import/no-deprecated': 'off', // Performance issues
|
|
35
|
-
'import/no-extraneous-dependencies': [
|
|
36
|
-
'error',
|
|
37
|
-
{
|
|
38
|
-
...importConfig.rules['import/no-extraneous-dependencies'][1],
|
|
39
|
-
devDependencies: [
|
|
40
|
-
...importConfig.rules['import/no-extraneous-dependencies'][1].devDependencies,
|
|
41
|
-
...configFiles,
|
|
42
|
-
],
|
|
43
|
-
},
|
|
44
|
-
],
|
|
45
|
-
'import/no-named-as-default': 'off', // Performance issues
|
|
46
|
-
'import/no-unused-modules': 'off', // Performance issues
|
|
47
|
-
'import/prefer-default-export': 'off', // Not aligned, default export does not bring sufficient semantic
|
|
48
|
-
'import/unambiguous': ESLintConfig.fixme('off'), // Disable because proposal still in progress
|
|
49
|
-
},
|
|
50
|
-
settings: {
|
|
51
|
-
'import/extensions': Project.sourceExtensions(),
|
|
52
|
-
|
|
53
|
-
// Resolve type definition packages
|
|
54
|
-
'import/external-module-folders': ['node_modules', 'node_modules/@types'],
|
|
55
|
-
'import/ignore': [...Project.ignored(), Project.extensionsToMatcher(Project.resourceExtensions()).source],
|
|
56
|
-
|
|
57
|
-
// Apply special parsing for TypeScript files
|
|
58
|
-
'import/parsers': {
|
|
59
|
-
'@typescript-eslint/parser': Project.queryExtensions(['typescript', 'typescriptreact']),
|
|
60
|
-
},
|
|
61
|
-
// Append 'ts' extensions to Airbnb 'import/resolver' setting
|
|
62
|
-
'import/resolver': {
|
|
63
|
-
node: {
|
|
64
|
-
extensions: [...Project.sourceExtensions(), '.json'],
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
overrides: [
|
|
71
|
-
{
|
|
72
|
-
files: [...configFiles, '**/*.d.ts'],
|
|
73
|
-
rules: {
|
|
74
|
-
'import/no-default-export': 'off', // Enable default exports only for config files
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
],
|
|
78
|
-
},
|
|
79
|
-
);
|
|
80
|
-
|
|
81
|
-
export = config;
|
package/src/rules/es/jsdoc.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type eslint from 'eslint';
|
|
2
|
-
|
|
3
|
-
const config: eslint.Linter.Config = {
|
|
4
|
-
extends: ['plugin:jsdoc/recommended'],
|
|
5
|
-
plugins: ['jsdoc'],
|
|
6
|
-
rules: {
|
|
7
|
-
'jsdoc/no-undefined-types': 'off', // https://github.com/gajus/eslint-plugin-jsdoc/issues/839
|
|
8
|
-
'jsdoc/require-hyphen-before-param-description': ['warn', 'always'],
|
|
9
|
-
'jsdoc/require-jsdoc': 'off',
|
|
10
|
-
'jsdoc/require-param-description': 'off',
|
|
11
|
-
'jsdoc/require-returns': 'off',
|
|
12
|
-
'jsdoc/tag-lines': ['warn', 'any', { startLines: 1 }],
|
|
13
|
-
'jsdoc/valid-types': 'off', // FIXME: reports lots of false positive
|
|
14
|
-
strict: ['error', 'safe'],
|
|
15
|
-
},
|
|
16
|
-
settings: {
|
|
17
|
-
jsdoc: {
|
|
18
|
-
mode: 'typescript',
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export = config;
|
package/src/rules/es/node.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type eslint from 'eslint';
|
|
2
|
-
|
|
3
|
-
const config: eslint.Linter.Config = {
|
|
4
|
-
extends: [],
|
|
5
|
-
plugins: ['n'],
|
|
6
|
-
rules: {
|
|
7
|
-
// 'n/handle-callback-err': ['error', '^(err|error|_error)$'],
|
|
8
|
-
'n/no-deprecated-api': 'error',
|
|
9
|
-
'n/no-exports-assign': 'error',
|
|
10
|
-
'n/no-new-require': 'error',
|
|
11
|
-
'n/no-path-concat': 'error',
|
|
12
|
-
'n/no-sync': 'error',
|
|
13
|
-
'n/prefer-global/buffer': ['error', 'never'],
|
|
14
|
-
'n/prefer-global/console': ['error', 'always'],
|
|
15
|
-
// 'n/prefer-global/process': ['error', 'never'],
|
|
16
|
-
'n/prefer-global/url': ['error', 'always'],
|
|
17
|
-
'n/prefer-global/url-search-params': ['error', 'always'],
|
|
18
|
-
'n/process-exit-as-throw': 'error',
|
|
19
|
-
},
|
|
20
|
-
};
|
|
21
|
-
export = config;
|
package/src/rules/es/promise.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { ESLintConfig } from '@w5s/dev';
|
|
2
|
-
import type eslint from 'eslint';
|
|
3
|
-
|
|
4
|
-
const config: eslint.Linter.Config = ESLintConfig.concat({
|
|
5
|
-
extends: ['plugin:promise/recommended'],
|
|
6
|
-
plugins: ['promise'],
|
|
7
|
-
rules: {
|
|
8
|
-
'promise/prefer-await-to-callbacks': ESLintConfig.fixme('error'), // https://github.com/xjamundx/eslint-plugin-promise/issues/212
|
|
9
|
-
'promise/prefer-await-to-then': 'error',
|
|
10
|
-
},
|
|
11
|
-
});
|
|
12
|
-
export = config;
|