@w5s/eslint-config 1.0.0-alpha.41 → 1.0.0-alpha.42
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/index.js +2 -19
- package/jest.js +15 -1
- package/json.js +1 -180
- package/package.json +3 -2
- package/rules/_rule.js +8 -22
- package/rules/jsonc.js +184 -0
- package/rules/unicorn.js +8 -0
- package/rules/yml.js +6 -0
- package/ts.js +32 -27
- package/yml.js +1 -3
package/index.js
CHANGED
|
@@ -24,28 +24,11 @@ module.exports = {
|
|
|
24
24
|
extends: [
|
|
25
25
|
require.resolve('./ignore'),
|
|
26
26
|
require.resolve('./es'),
|
|
27
|
+
...includeIf(tryResolve('typescript'), require.resolve('./ts')),
|
|
27
28
|
require.resolve('./json'),
|
|
28
29
|
require.resolve('./yml'),
|
|
30
|
+
require.resolve('./jest'),
|
|
29
31
|
...includeIf(tryResolve('react'), require.resolve('./react')),
|
|
30
32
|
],
|
|
31
|
-
overrides: [
|
|
32
|
-
...includeIf(tryResolve('typescript'), {
|
|
33
|
-
extends: [require.resolve('./ts')],
|
|
34
|
-
files: ['*.+(ts|tsx)'],
|
|
35
|
-
}),
|
|
36
|
-
{
|
|
37
|
-
extends: [require.resolve('./jest')],
|
|
38
|
-
files: [
|
|
39
|
-
'**/__mocks__/**/*.+(ts|tsx|js|jsx)',
|
|
40
|
-
'**/__tests__/**/*.+(ts|tsx|js|jsx)',
|
|
41
|
-
'**/?(*.)+(spec|test).+(ts|tsx|js|jsx)',
|
|
42
|
-
],
|
|
43
|
-
settings: {
|
|
44
|
-
jest: {
|
|
45
|
-
version: 'latest',
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
],
|
|
50
33
|
root: true,
|
|
51
34
|
};
|
package/jest.js
CHANGED
|
@@ -1,4 +1,18 @@
|
|
|
1
1
|
// http://eslint.org/docs/user-guide/configuring
|
|
2
2
|
module.exports = {
|
|
3
|
-
|
|
3
|
+
overrides: [
|
|
4
|
+
{
|
|
5
|
+
extends: [require.resolve('./rules/jest')],
|
|
6
|
+
files: [
|
|
7
|
+
'**/__mocks__/**/*.+(ts|tsx|js|jsx)',
|
|
8
|
+
'**/__tests__/**/*.+(ts|tsx|js|jsx)',
|
|
9
|
+
'**/?(*.)+(spec|test).+(ts|tsx|js|jsx)',
|
|
10
|
+
],
|
|
11
|
+
settings: {
|
|
12
|
+
jest: {
|
|
13
|
+
version: 'latest',
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
],
|
|
4
18
|
};
|
package/json.js
CHANGED
|
@@ -1,189 +1,10 @@
|
|
|
1
1
|
/* cspell:disable */
|
|
2
2
|
// https://github.com/keithamus/sort-package-json/blob/master/defaultRules.md
|
|
3
3
|
module.exports = {
|
|
4
|
-
extends: ['plugin:jsonc/recommended-with-jsonc', 'plugin:jsonc/prettier'],
|
|
5
4
|
overrides: [
|
|
6
5
|
{
|
|
6
|
+
extends: [require.resolve('./rules/jsonc.js')],
|
|
7
7
|
files: ['*.json', '*.json5', '*.jsonc'],
|
|
8
|
-
parser: 'jsonc-eslint-parser',
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
files: ['tsconfig*.json'],
|
|
12
|
-
rules: {
|
|
13
|
-
'jsonc/sort-keys': [
|
|
14
|
-
'error',
|
|
15
|
-
{
|
|
16
|
-
order: ['$schema', 'display', 'extends', 'compilerOptions', 'include', 'exclude', 'files', 'references'],
|
|
17
|
-
pathPattern: '^$',
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
order: { type: 'asc' },
|
|
21
|
-
pathPattern: '.*',
|
|
22
|
-
},
|
|
23
|
-
],
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
files: ['package.json'],
|
|
28
|
-
parser: 'jsonc-eslint-parser',
|
|
29
|
-
rules: {
|
|
30
|
-
'jsonc/sort-keys': [
|
|
31
|
-
'error',
|
|
32
|
-
{
|
|
33
|
-
order: [
|
|
34
|
-
'$schema',
|
|
35
|
-
'name',
|
|
36
|
-
'displayName',
|
|
37
|
-
'version',
|
|
38
|
-
'private',
|
|
39
|
-
'description',
|
|
40
|
-
'categories',
|
|
41
|
-
'keywords',
|
|
42
|
-
'homepage',
|
|
43
|
-
'bugs',
|
|
44
|
-
'repository',
|
|
45
|
-
'funding',
|
|
46
|
-
'license',
|
|
47
|
-
'qna',
|
|
48
|
-
'author',
|
|
49
|
-
'maintainers', // Key order (per item): name, email, url
|
|
50
|
-
'contributors', // Key order (per item): name, email, url
|
|
51
|
-
'publisher',
|
|
52
|
-
'sideEffects',
|
|
53
|
-
'type',
|
|
54
|
-
'imports',
|
|
55
|
-
'exports',
|
|
56
|
-
'main',
|
|
57
|
-
'svelte',
|
|
58
|
-
'umd:main',
|
|
59
|
-
'jsdelivr',
|
|
60
|
-
'unpkg',
|
|
61
|
-
'module',
|
|
62
|
-
'source',
|
|
63
|
-
'jsnext:main',
|
|
64
|
-
'browser',
|
|
65
|
-
'react-native',
|
|
66
|
-
'types',
|
|
67
|
-
'typesVersions',
|
|
68
|
-
'typings',
|
|
69
|
-
'style',
|
|
70
|
-
'example',
|
|
71
|
-
'examplestyle',
|
|
72
|
-
'assets',
|
|
73
|
-
'bin',
|
|
74
|
-
'man',
|
|
75
|
-
'directories', // Key order: lib, bin, man, doc, example, test
|
|
76
|
-
'files', // Unique items
|
|
77
|
-
'workspaces',
|
|
78
|
-
'binary', // Key order: module_name, module_path, remote_path, package_name, host
|
|
79
|
-
'scripts', // Script sort
|
|
80
|
-
'betterScripts', // Script sort
|
|
81
|
-
'contributes',
|
|
82
|
-
'activationEvents', // Unique items
|
|
83
|
-
'husky', // Sorts the hooks field using git hook sort
|
|
84
|
-
'simple-git-hooks', // Key sort using git hook sort
|
|
85
|
-
'pre-commit',
|
|
86
|
-
'commitlint',
|
|
87
|
-
'lint-staged',
|
|
88
|
-
'config',
|
|
89
|
-
'nodemonConfig',
|
|
90
|
-
'browserify',
|
|
91
|
-
'babel',
|
|
92
|
-
'browserslist',
|
|
93
|
-
'xo',
|
|
94
|
-
'prettier', // Prettier sort
|
|
95
|
-
'eslintConfig', // ESLint sort
|
|
96
|
-
'eslintIgnore',
|
|
97
|
-
'npmpackagejsonlint', // Key sort (also recognizes: npmPackageJsonLintConfig, npmpkgjsonlint)
|
|
98
|
-
'release',
|
|
99
|
-
'remarkConfig',
|
|
100
|
-
'stylelint',
|
|
101
|
-
'ava',
|
|
102
|
-
'jest',
|
|
103
|
-
'mocha',
|
|
104
|
-
'nyc',
|
|
105
|
-
'tap',
|
|
106
|
-
'resolutions',
|
|
107
|
-
'dependencies',
|
|
108
|
-
'devDependencies',
|
|
109
|
-
'dependenciesMeta', // Key sort (deep)
|
|
110
|
-
'peerDependencies',
|
|
111
|
-
'peerDependenciesMeta', // Key sort (deep)
|
|
112
|
-
'optionalDependencies',
|
|
113
|
-
'bundledDependencies',
|
|
114
|
-
'bundleDependencies',
|
|
115
|
-
'extensionPack',
|
|
116
|
-
'extensionDependencies',
|
|
117
|
-
'flat',
|
|
118
|
-
'packageManager',
|
|
119
|
-
'engines',
|
|
120
|
-
'engineStrict',
|
|
121
|
-
'volta', // Key order: node, npm, yarn
|
|
122
|
-
'languageName',
|
|
123
|
-
'os',
|
|
124
|
-
'cpu',
|
|
125
|
-
'preferGlobal',
|
|
126
|
-
'publishConfig',
|
|
127
|
-
'icon',
|
|
128
|
-
'badges', // Key order (per item): description, url, href
|
|
129
|
-
'galleryBanner',
|
|
130
|
-
'preview',
|
|
131
|
-
'markdown',
|
|
132
|
-
],
|
|
133
|
-
pathPattern: '^$',
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
order: ['url', 'email'],
|
|
137
|
-
pathPattern: `^bugs$`,
|
|
138
|
-
},
|
|
139
|
-
...['repository', 'funding', 'license', 'author'].map((key) => ({
|
|
140
|
-
order: ['type', 'name', 'email', 'url'],
|
|
141
|
-
pathPattern: `^${key}$`,
|
|
142
|
-
})),
|
|
143
|
-
...['scripts', 'betterScripts'].map((key) => ({
|
|
144
|
-
order: { type: 'asc' },
|
|
145
|
-
pathPattern: `^${key}$`,
|
|
146
|
-
})),
|
|
147
|
-
...[
|
|
148
|
-
'bin',
|
|
149
|
-
'contributes',
|
|
150
|
-
'commitlint',
|
|
151
|
-
'config',
|
|
152
|
-
'nodemonConfig',
|
|
153
|
-
'browserify',
|
|
154
|
-
'babel',
|
|
155
|
-
'xo',
|
|
156
|
-
'release',
|
|
157
|
-
'remarkConfig',
|
|
158
|
-
'ava',
|
|
159
|
-
'jest',
|
|
160
|
-
'mocha',
|
|
161
|
-
'nyc',
|
|
162
|
-
'tap',
|
|
163
|
-
'resolutions',
|
|
164
|
-
'engines',
|
|
165
|
-
'engineStrict',
|
|
166
|
-
'preferGlobal',
|
|
167
|
-
'publishConfig',
|
|
168
|
-
'galleryBanner',
|
|
169
|
-
].map((key) => ({
|
|
170
|
-
order: { type: 'asc' },
|
|
171
|
-
pathPattern: `^${key}$`,
|
|
172
|
-
})),
|
|
173
|
-
{
|
|
174
|
-
order: { type: 'asc' },
|
|
175
|
-
pathPattern: '^(?:dev|peer|optional|bundled|extension)?[Dd]ependencies$',
|
|
176
|
-
},
|
|
177
|
-
{
|
|
178
|
-
order: ['types', 'require', 'import'],
|
|
179
|
-
pathPattern: '^exports.*$',
|
|
180
|
-
},
|
|
181
|
-
],
|
|
182
|
-
},
|
|
183
8
|
},
|
|
184
9
|
],
|
|
185
|
-
plugins: ['jsonc'],
|
|
186
|
-
rules: {
|
|
187
|
-
// 'jsonc/sort-keys': 'error',
|
|
188
|
-
},
|
|
189
10
|
};
|
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.42",
|
|
4
4
|
"description": "ESLint configuration presets",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -79,6 +79,7 @@
|
|
|
79
79
|
"@babel/eslint-parser": "7.19.1",
|
|
80
80
|
"@types/eslint": "8.4.10",
|
|
81
81
|
"@types/eslint-plugin-prettier": "3.1.0",
|
|
82
|
+
"@types/jest": "29.2.4",
|
|
82
83
|
"@types/prettier": "2.7.1",
|
|
83
84
|
"@types/react": "18.0.26",
|
|
84
85
|
"@typescript-eslint/parser": "5.46.0",
|
|
@@ -103,5 +104,5 @@
|
|
|
103
104
|
"publishConfig": {
|
|
104
105
|
"access": "public"
|
|
105
106
|
},
|
|
106
|
-
"gitHead": "
|
|
107
|
+
"gitHead": "a471255b755549d87ea56b49dfe75bd54505b5b0"
|
|
107
108
|
}
|
package/rules/_rule.js
CHANGED
|
@@ -8,27 +8,12 @@ const warn = 'warn';
|
|
|
8
8
|
const off = 'off';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* @typedef {
|
|
12
|
-
* env?: Record<string, boolean>,
|
|
13
|
-
* extends?: string[]|string,
|
|
14
|
-
* plugins?: string[]|string,
|
|
15
|
-
* rules?: Record<string, unknown>,
|
|
16
|
-
* settings?: Record<string, unknown>,
|
|
17
|
-
* }} ESLintConfigInit
|
|
18
|
-
*/
|
|
19
|
-
/**
|
|
20
|
-
* @typedef {{
|
|
21
|
-
* env: Record<string, boolean>,
|
|
22
|
-
* extends: string[],
|
|
23
|
-
* plugins: string[],
|
|
24
|
-
* rules: Record<string, unknown>,
|
|
25
|
-
* settings: Record<string, unknown>,
|
|
26
|
-
* }} ESLintConfig
|
|
11
|
+
* @typedef {import("eslint").ESLint.ConfigData} ESLintConfig
|
|
27
12
|
*/
|
|
28
13
|
|
|
29
14
|
/**
|
|
30
|
-
* @
|
|
31
|
-
|
|
15
|
+
* @type {<T>(value: T[]|T|undefined) => T[]}
|
|
16
|
+
*/
|
|
32
17
|
function toArray(value) {
|
|
33
18
|
if (value == null) {
|
|
34
19
|
return [];
|
|
@@ -40,20 +25,20 @@ function toArray(value) {
|
|
|
40
25
|
}
|
|
41
26
|
|
|
42
27
|
/**
|
|
43
|
-
* @
|
|
44
|
-
* @type {(left: T[]|T|undefined, right:T[]|T|undefined) => T[]}
|
|
28
|
+
* @type {<T>(left: T[]|T|undefined, right:T[]|T|undefined) => T[]}
|
|
45
29
|
*/
|
|
46
30
|
function concatArray(left, right) {
|
|
47
31
|
return toArray(left).concat(toArray(right));
|
|
48
32
|
}
|
|
49
33
|
|
|
50
|
-
/** @type {(...configs:
|
|
34
|
+
/** @type {(...configs: ESLintConfig[]) => ESLintConfig} */
|
|
51
35
|
function concatESConfig(...configs) {
|
|
52
36
|
return configs.reduce(
|
|
53
|
-
(/** @type {ESLintConfig} */ returnValue, /** @type {
|
|
37
|
+
(/** @type {ESLintConfig} */ returnValue, /** @type {ESLintConfig} */ config) =>
|
|
54
38
|
Object.assign({}, returnValue, config, {
|
|
55
39
|
env: Object.assign({}, returnValue.env, config.env),
|
|
56
40
|
extends: concatArray(returnValue.extends, config.extends),
|
|
41
|
+
overrides: concatArray(returnValue.overrides, config.overrides),
|
|
57
42
|
plugins: concatArray(returnValue.plugins, config.plugins),
|
|
58
43
|
rules: Object.assign({}, returnValue.rules, config.rules),
|
|
59
44
|
settings: Object.assign({}, returnValue.settings, config.settings),
|
|
@@ -61,6 +46,7 @@ function concatESConfig(...configs) {
|
|
|
61
46
|
{
|
|
62
47
|
env: {},
|
|
63
48
|
extends: [],
|
|
49
|
+
overrides: [],
|
|
64
50
|
plugins: [],
|
|
65
51
|
rules: {},
|
|
66
52
|
settings: {},
|
package/rules/jsonc.js
ADDED
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
/* cspell:disable */
|
|
2
|
+
const { error } = require('./_rule.js');
|
|
3
|
+
|
|
4
|
+
// https://github.com/keithamus/sort-package-json/blob/master/defaultRules.md
|
|
5
|
+
module.exports = {
|
|
6
|
+
extends: ['plugin:jsonc/recommended-with-jsonc', 'plugin:jsonc/prettier'],
|
|
7
|
+
overrides: [
|
|
8
|
+
{
|
|
9
|
+
files: ['tsconfig*.json'],
|
|
10
|
+
rules: {
|
|
11
|
+
'jsonc/sort-keys': [
|
|
12
|
+
error,
|
|
13
|
+
{
|
|
14
|
+
order: ['$schema', 'display', 'extends', 'compilerOptions', 'include', 'exclude', 'files', 'references'],
|
|
15
|
+
pathPattern: '^$',
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
order: { type: 'asc' },
|
|
19
|
+
pathPattern: '.*',
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
files: ['package.json'],
|
|
26
|
+
rules: {
|
|
27
|
+
'jsonc/sort-keys': [
|
|
28
|
+
error,
|
|
29
|
+
{
|
|
30
|
+
order: [
|
|
31
|
+
'$schema',
|
|
32
|
+
'name',
|
|
33
|
+
'displayName',
|
|
34
|
+
'version',
|
|
35
|
+
'private',
|
|
36
|
+
'description',
|
|
37
|
+
'categories',
|
|
38
|
+
'keywords',
|
|
39
|
+
'homepage',
|
|
40
|
+
'bugs',
|
|
41
|
+
'repository',
|
|
42
|
+
'funding',
|
|
43
|
+
'license',
|
|
44
|
+
'qna',
|
|
45
|
+
'author',
|
|
46
|
+
'maintainers', // Key order (per item): name, email, url
|
|
47
|
+
'contributors', // Key order (per item): name, email, url
|
|
48
|
+
'publisher',
|
|
49
|
+
'sideEffects',
|
|
50
|
+
'type',
|
|
51
|
+
'imports',
|
|
52
|
+
'exports',
|
|
53
|
+
'main',
|
|
54
|
+
'svelte',
|
|
55
|
+
'umd:main',
|
|
56
|
+
'jsdelivr',
|
|
57
|
+
'unpkg',
|
|
58
|
+
'module',
|
|
59
|
+
'source',
|
|
60
|
+
'jsnext:main',
|
|
61
|
+
'browser',
|
|
62
|
+
'react-native',
|
|
63
|
+
'types',
|
|
64
|
+
'typesVersions',
|
|
65
|
+
'typings',
|
|
66
|
+
'style',
|
|
67
|
+
'example',
|
|
68
|
+
'examplestyle',
|
|
69
|
+
'assets',
|
|
70
|
+
'bin',
|
|
71
|
+
'man',
|
|
72
|
+
'directories', // Key order: lib, bin, man, doc, example, test
|
|
73
|
+
'files', // Unique items
|
|
74
|
+
'workspaces',
|
|
75
|
+
'binary', // Key order: module_name, module_path, remote_path, package_name, host
|
|
76
|
+
'scripts', // Script sort
|
|
77
|
+
'betterScripts', // Script sort
|
|
78
|
+
'contributes',
|
|
79
|
+
'activationEvents', // Unique items
|
|
80
|
+
'husky', // Sorts the hooks field using git hook sort
|
|
81
|
+
'simple-git-hooks', // Key sort using git hook sort
|
|
82
|
+
'pre-commit',
|
|
83
|
+
'commitlint',
|
|
84
|
+
'lint-staged',
|
|
85
|
+
'config',
|
|
86
|
+
'nodemonConfig',
|
|
87
|
+
'browserify',
|
|
88
|
+
'babel',
|
|
89
|
+
'browserslist',
|
|
90
|
+
'xo',
|
|
91
|
+
'prettier', // Prettier sort
|
|
92
|
+
'eslintConfig', // ESLint sort
|
|
93
|
+
'eslintIgnore',
|
|
94
|
+
'npmpackagejsonlint', // Key sort (also recognizes: npmPackageJsonLintConfig, npmpkgjsonlint)
|
|
95
|
+
'release',
|
|
96
|
+
'remarkConfig',
|
|
97
|
+
'stylelint',
|
|
98
|
+
'ava',
|
|
99
|
+
'jest',
|
|
100
|
+
'mocha',
|
|
101
|
+
'nyc',
|
|
102
|
+
'tap',
|
|
103
|
+
'resolutions',
|
|
104
|
+
'dependencies',
|
|
105
|
+
'devDependencies',
|
|
106
|
+
'dependenciesMeta', // Key sort (deep)
|
|
107
|
+
'peerDependencies',
|
|
108
|
+
'peerDependenciesMeta', // Key sort (deep)
|
|
109
|
+
'optionalDependencies',
|
|
110
|
+
'bundledDependencies',
|
|
111
|
+
'bundleDependencies',
|
|
112
|
+
'extensionPack',
|
|
113
|
+
'extensionDependencies',
|
|
114
|
+
'flat',
|
|
115
|
+
'packageManager',
|
|
116
|
+
'engines',
|
|
117
|
+
'engineStrict',
|
|
118
|
+
'volta', // Key order: node, npm, yarn
|
|
119
|
+
'languageName',
|
|
120
|
+
'os',
|
|
121
|
+
'cpu',
|
|
122
|
+
'preferGlobal',
|
|
123
|
+
'publishConfig',
|
|
124
|
+
'icon',
|
|
125
|
+
'badges', // Key order (per item): description, url, href
|
|
126
|
+
'galleryBanner',
|
|
127
|
+
'preview',
|
|
128
|
+
'markdown',
|
|
129
|
+
],
|
|
130
|
+
pathPattern: '^$',
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
order: ['url', 'email'],
|
|
134
|
+
pathPattern: `^bugs$`,
|
|
135
|
+
},
|
|
136
|
+
...['repository', 'funding', 'license', 'author'].map((key) => ({
|
|
137
|
+
order: ['type', 'name', 'email', 'url'],
|
|
138
|
+
pathPattern: `^${key}$`,
|
|
139
|
+
})),
|
|
140
|
+
...['scripts', 'betterScripts'].map((key) => ({
|
|
141
|
+
order: { type: 'asc' },
|
|
142
|
+
pathPattern: `^${key}$`,
|
|
143
|
+
})),
|
|
144
|
+
...[
|
|
145
|
+
'bin',
|
|
146
|
+
'contributes',
|
|
147
|
+
'commitlint',
|
|
148
|
+
'config',
|
|
149
|
+
'nodemonConfig',
|
|
150
|
+
'browserify',
|
|
151
|
+
'babel',
|
|
152
|
+
'xo',
|
|
153
|
+
'release',
|
|
154
|
+
'remarkConfig',
|
|
155
|
+
'ava',
|
|
156
|
+
'jest',
|
|
157
|
+
'mocha',
|
|
158
|
+
'nyc',
|
|
159
|
+
'tap',
|
|
160
|
+
'resolutions',
|
|
161
|
+
'engines',
|
|
162
|
+
'engineStrict',
|
|
163
|
+
'preferGlobal',
|
|
164
|
+
'publishConfig',
|
|
165
|
+
'galleryBanner',
|
|
166
|
+
].map((key) => ({
|
|
167
|
+
order: { type: 'asc' },
|
|
168
|
+
pathPattern: `^${key}$`,
|
|
169
|
+
})),
|
|
170
|
+
{
|
|
171
|
+
order: { type: 'asc' },
|
|
172
|
+
pathPattern: '^(?:dev|peer|optional|bundled|extension)?[Dd]ependencies$',
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
order: ['types', 'require', 'import'],
|
|
176
|
+
pathPattern: '^exports.*$',
|
|
177
|
+
},
|
|
178
|
+
],
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
],
|
|
182
|
+
parser: 'jsonc-eslint-parser',
|
|
183
|
+
plugins: ['jsonc'],
|
|
184
|
+
};
|
package/rules/unicorn.js
CHANGED
|
@@ -47,6 +47,14 @@ module.exports = concatESConfig(
|
|
|
47
47
|
},
|
|
48
48
|
},
|
|
49
49
|
{
|
|
50
|
+
overrides: [
|
|
51
|
+
{
|
|
52
|
+
files: ['**/+(babel|jest|next|vue).config.js'],
|
|
53
|
+
rules: {
|
|
54
|
+
'unicorn/prefer-module': 'off',
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
],
|
|
50
58
|
rules: {
|
|
51
59
|
'unicorn/consistent-destructuring': off,
|
|
52
60
|
'unicorn/consistent-function-scoping': off, // Too many false positive
|
package/rules/yml.js
ADDED
package/ts.js
CHANGED
|
@@ -1,35 +1,40 @@
|
|
|
1
1
|
// http://eslint.org/docs/user-guide/configuring
|
|
2
2
|
module.exports = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
3
|
+
overrides: [
|
|
4
|
+
{
|
|
5
|
+
extends: [
|
|
6
|
+
require.resolve('./rules/base'),
|
|
7
|
+
require.resolve('./rules/jsdoc'),
|
|
8
|
+
require.resolve('./rules/import'),
|
|
9
|
+
require.resolve('./rules/unicorn'),
|
|
10
|
+
'plugin:import/typescript',
|
|
11
|
+
require.resolve('./rules/typescript'),
|
|
12
|
+
require.resolve('./rules/prettier'),
|
|
13
|
+
],
|
|
14
|
+
files: ['*.+(ts|tsx)'],
|
|
15
|
+
parser: '@typescript-eslint/parser',
|
|
16
|
+
parserOptions: {
|
|
17
|
+
sourceType: 'module',
|
|
18
|
+
},
|
|
19
|
+
settings: {
|
|
20
|
+
// Append 'ts' extensions to Airbnb 'import/extensions' setting
|
|
21
|
+
'import/extensions': ['.js', '.mjs', '.jsx', '.ts', '.tsx', '.d.ts'],
|
|
19
22
|
|
|
20
|
-
|
|
21
|
-
|
|
23
|
+
// Resolve type definition packages
|
|
24
|
+
'import/external-module-folders': ['node_modules', 'node_modules/@types'],
|
|
22
25
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
// Apply special parsing for TypeScript files
|
|
27
|
+
'import/parsers': {
|
|
28
|
+
'@typescript-eslint/parser': ['.ts', '.tsx', '.d.ts'],
|
|
29
|
+
},
|
|
27
30
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
// Append 'ts' extensions to Airbnb 'import/resolver' setting
|
|
32
|
+
'import/resolver': {
|
|
33
|
+
node: {
|
|
34
|
+
extensions: ['.mjs', '.js', '.json', '.ts', '.d.ts'],
|
|
35
|
+
},
|
|
36
|
+
},
|
|
32
37
|
},
|
|
33
38
|
},
|
|
34
|
-
|
|
39
|
+
],
|
|
35
40
|
};
|
package/yml.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
/* cspell:disable */
|
|
2
2
|
module.exports = {
|
|
3
|
-
extends: ['plugin:yml/standard', 'plugin:yml/prettier'],
|
|
4
3
|
overrides: [
|
|
5
4
|
{
|
|
5
|
+
extends: [require.resolve('./rules/yml')],
|
|
6
6
|
files: ['*.yml', '*.yaml'],
|
|
7
|
-
parser: 'yaml-eslint-parser',
|
|
8
7
|
},
|
|
9
8
|
],
|
|
10
|
-
plugins: ['yml'],
|
|
11
9
|
};
|