@w5s/eslint-config 1.2.1 → 1.3.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/jest.js +4 -4
- package/dist/rules/es/import.js +4 -4
- package/dist/rules/ignore.js +1 -1
- package/dist/ts.js +5 -1
- package/package.json +6 -6
- package/src/jest.ts +5 -5
- package/src/rules/es/import.ts +5 -5
- package/src/rules/ignore.ts +2 -2
- package/src/ts.ts +7 -2
package/dist/jest.js
CHANGED
|
@@ -4,15 +4,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
const dev_1 = require("@w5s/dev");
|
|
6
6
|
const jest_js_1 = __importDefault(require("./rules/jest.js"));
|
|
7
|
-
const
|
|
7
|
+
const sourceGlob = dev_1.Project.extensionsToGlob(dev_1.Project.sourceExtensions());
|
|
8
8
|
const config = {
|
|
9
9
|
overrides: [
|
|
10
10
|
{
|
|
11
11
|
...jest_js_1.default,
|
|
12
12
|
files: [
|
|
13
|
-
`**/__mocks__
|
|
14
|
-
`**/__tests__
|
|
15
|
-
`**/?(*.)+(spec|test)
|
|
13
|
+
`**/__mocks__/**/${sourceGlob}`,
|
|
14
|
+
`**/__tests__/**/${sourceGlob}`,
|
|
15
|
+
`**/?(*.)+(spec|test)${sourceGlob.slice(1)}`,
|
|
16
16
|
],
|
|
17
17
|
},
|
|
18
18
|
],
|
package/dist/rules/es/import.js
CHANGED
|
@@ -37,18 +37,18 @@ const config = dev_1.ESLintConfig.concat(imports_1.default,
|
|
|
37
37
|
'import/unambiguous': dev_1.ESLintConfig.fixme('off'), // Disable because proposal still in progress
|
|
38
38
|
},
|
|
39
39
|
settings: {
|
|
40
|
-
'import/extensions': dev_1.
|
|
40
|
+
'import/extensions': dev_1.Project.sourceExtensions(),
|
|
41
41
|
// Resolve type definition packages
|
|
42
42
|
'import/external-module-folders': ['node_modules', 'node_modules/@types'],
|
|
43
|
-
'import/ignore': [...dev_1.
|
|
43
|
+
'import/ignore': [...dev_1.Project.ignored(), dev_1.Project.extensionsToMatcher(dev_1.Project.resourceExtensions()).source],
|
|
44
44
|
// Apply special parsing for TypeScript files
|
|
45
45
|
'import/parsers': {
|
|
46
|
-
'@typescript-eslint/parser': dev_1.
|
|
46
|
+
'@typescript-eslint/parser': dev_1.Project.sourceExtensions().filter((ext) => !ext.includes('js')),
|
|
47
47
|
},
|
|
48
48
|
// Append 'ts' extensions to Airbnb 'import/resolver' setting
|
|
49
49
|
'import/resolver': {
|
|
50
50
|
node: {
|
|
51
|
-
extensions: [...dev_1.
|
|
51
|
+
extensions: [...dev_1.Project.sourceExtensions(), '.json'],
|
|
52
52
|
},
|
|
53
53
|
},
|
|
54
54
|
},
|
package/dist/rules/ignore.js
CHANGED
|
@@ -3,9 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
const node_fs_1 = require("node:fs");
|
|
6
|
+
const node_path_1 = require("node:path");
|
|
6
7
|
const find_up_1 = __importDefault(require("find-up"));
|
|
7
8
|
const parse_gitignore_1 = __importDefault(require("parse-gitignore"));
|
|
8
|
-
const node_path_1 = require("node:path");
|
|
9
9
|
const getGitignore = (prefix = '') => {
|
|
10
10
|
const cwd = process.cwd();
|
|
11
11
|
const gitIgnoreFile = find_up_1.default.sync((0, node_path_1.join)(prefix, '.gitignore'), { cwd });
|
package/dist/ts.js
CHANGED
|
@@ -10,7 +10,11 @@ const config = {
|
|
|
10
10
|
...dev_1.ESLintConfig.concat({
|
|
11
11
|
extends: [require.resolve('./rules/typescript.js')],
|
|
12
12
|
}, prettier_js_1.default),
|
|
13
|
-
files: [
|
|
13
|
+
files: [
|
|
14
|
+
dev_1.Project.extensionsToGlob(
|
|
15
|
+
// ts only extensions
|
|
16
|
+
dev_1.Project.sourceExtensions().filter((_) => _.includes('ts'))),
|
|
17
|
+
],
|
|
14
18
|
},
|
|
15
19
|
],
|
|
16
20
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@w5s/eslint-config",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"description": "ESLint configuration presets",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@rushstack/eslint-patch": "^1.1.0",
|
|
50
50
|
"@typescript-eslint/eslint-plugin": "^6.0.0",
|
|
51
51
|
"@typescript-eslint/parser": "^6.0.0",
|
|
52
|
-
"@w5s/dev": "^1.
|
|
52
|
+
"@w5s/dev": "^1.3.0",
|
|
53
53
|
"@w5s/prettier-config": "^1.1.2",
|
|
54
54
|
"eslint-config-airbnb-base": "^15.0.0",
|
|
55
55
|
"eslint-config-prettier": "^8.0.0",
|
|
@@ -67,9 +67,9 @@
|
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"@types/eslint": "8.44.1",
|
|
69
69
|
"@types/parse-gitignore": "1.0.0",
|
|
70
|
-
"@types/react": "18.2.
|
|
71
|
-
"@typescript-eslint/parser": "6.2.
|
|
72
|
-
"eslint": "8.
|
|
70
|
+
"@types/react": "18.2.18",
|
|
71
|
+
"@typescript-eslint/parser": "6.2.1",
|
|
72
|
+
"eslint": "8.46.0",
|
|
73
73
|
"eslint-config-prettier": "8.9.0",
|
|
74
74
|
"eslint-find-rules": "4.1.0",
|
|
75
75
|
"prettier": "3.0.0",
|
|
@@ -96,5 +96,5 @@
|
|
|
96
96
|
"publishConfig": {
|
|
97
97
|
"access": "public"
|
|
98
98
|
},
|
|
99
|
-
"gitHead": "
|
|
99
|
+
"gitHead": "024ef9515d39f1c6eb891d7e7427212b2b06c952"
|
|
100
100
|
}
|
package/src/jest.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import type eslint from 'eslint';
|
|
2
|
-
import {
|
|
2
|
+
import { Project } from '@w5s/dev';
|
|
3
3
|
import jestConfig from './rules/jest.js';
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const sourceGlob = Project.extensionsToGlob(Project.sourceExtensions());
|
|
6
6
|
const config: eslint.Linter.Config = {
|
|
7
7
|
overrides: [
|
|
8
8
|
{
|
|
9
9
|
...jestConfig,
|
|
10
10
|
files: [
|
|
11
|
-
`**/__mocks__
|
|
12
|
-
`**/__tests__
|
|
13
|
-
`**/?(*.)+(spec|test)
|
|
11
|
+
`**/__mocks__/**/${sourceGlob}`,
|
|
12
|
+
`**/__tests__/**/${sourceGlob}`,
|
|
13
|
+
`**/?(*.)+(spec|test)${sourceGlob.slice(1)}`,
|
|
14
14
|
],
|
|
15
15
|
},
|
|
16
16
|
],
|
package/src/rules/es/import.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ESLintConfig,
|
|
1
|
+
import { ESLintConfig, Project } from '@w5s/dev';
|
|
2
2
|
import type eslint from 'eslint';
|
|
3
3
|
// @ts-ignore airbnb is not typed
|
|
4
4
|
import importConfig from 'eslint-config-airbnb-base/rules/imports';
|
|
@@ -37,20 +37,20 @@ const config: eslint.Linter.Config = ESLintConfig.concat(
|
|
|
37
37
|
'import/unambiguous': ESLintConfig.fixme('off'), // Disable because proposal still in progress
|
|
38
38
|
},
|
|
39
39
|
settings: {
|
|
40
|
-
'import/extensions':
|
|
40
|
+
'import/extensions': Project.sourceExtensions(),
|
|
41
41
|
|
|
42
42
|
// Resolve type definition packages
|
|
43
43
|
'import/external-module-folders': ['node_modules', 'node_modules/@types'],
|
|
44
|
-
'import/ignore': [...
|
|
44
|
+
'import/ignore': [...Project.ignored(), Project.extensionsToMatcher(Project.resourceExtensions()).source],
|
|
45
45
|
|
|
46
46
|
// Apply special parsing for TypeScript files
|
|
47
47
|
'import/parsers': {
|
|
48
|
-
'@typescript-eslint/parser':
|
|
48
|
+
'@typescript-eslint/parser': Project.sourceExtensions().filter((ext) => !ext.includes('js')),
|
|
49
49
|
},
|
|
50
50
|
// Append 'ts' extensions to Airbnb 'import/resolver' setting
|
|
51
51
|
'import/resolver': {
|
|
52
52
|
node: {
|
|
53
|
-
extensions: [...
|
|
53
|
+
extensions: [...Project.sourceExtensions(), '.json'],
|
|
54
54
|
},
|
|
55
55
|
},
|
|
56
56
|
},
|
package/src/rules/ignore.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type eslint from 'eslint';
|
|
2
1
|
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { join as pathJoin } from 'node:path';
|
|
3
|
+
import type eslint from 'eslint';
|
|
3
4
|
import findUp from 'find-up';
|
|
4
5
|
import parseGitignore from 'parse-gitignore';
|
|
5
|
-
import { join as pathJoin } from 'node:path';
|
|
6
6
|
|
|
7
7
|
const getGitignore = (prefix = '') => {
|
|
8
8
|
const cwd = process.cwd();
|
package/src/ts.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type eslint from 'eslint';
|
|
2
|
-
import {
|
|
2
|
+
import { ESLintConfig, Project } from '@w5s/dev';
|
|
3
3
|
import prettierConfig from './rules/prettier.js';
|
|
4
4
|
|
|
5
5
|
const config: eslint.Linter.Config = {
|
|
@@ -11,7 +11,12 @@ const config: eslint.Linter.Config = {
|
|
|
11
11
|
},
|
|
12
12
|
prettierConfig
|
|
13
13
|
),
|
|
14
|
-
files: [
|
|
14
|
+
files: [
|
|
15
|
+
Project.extensionsToGlob(
|
|
16
|
+
// ts only extensions
|
|
17
|
+
Project.sourceExtensions().filter((_) => _.includes('ts'))
|
|
18
|
+
),
|
|
19
|
+
],
|
|
15
20
|
},
|
|
16
21
|
],
|
|
17
22
|
};
|