@fullstacksjs/eslint-config 12.3.0 → 12.4.0
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/README.md +1 -0
- package/cjs/index.d.ts +32 -30
- package/cjs/index.js +3 -1
- package/cjs/modules/ignore.js +6 -1
- package/package.json +2 -1
- package/src/index.d.ts +32 -30
- package/src/index.mjs +3 -1
- package/src/modules/ignore.mjs +6 -1
package/README.md
CHANGED
|
@@ -73,6 +73,7 @@ interface Options {
|
|
|
73
73
|
next?: boolean; // controls next plugin
|
|
74
74
|
prettier?: boolean; // controls prettier plugin
|
|
75
75
|
disableExpensiveRules?: boolean; // controls expensive rules
|
|
76
|
+
gitignorePath?: string; // automatically ignore paths from .gitignore
|
|
76
77
|
}
|
|
77
78
|
```
|
|
78
79
|
|
package/cjs/index.d.ts
CHANGED
|
@@ -9,8 +9,8 @@ interface ProjectService {
|
|
|
9
9
|
|
|
10
10
|
export interface Options extends Linter.Config {
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
12
|
+
* Controls React plugin.
|
|
13
|
+
* @default true - If you have `react` or `react-dom` in your dependencies.
|
|
14
14
|
*/
|
|
15
15
|
react?: boolean;
|
|
16
16
|
/**
|
|
@@ -18,89 +18,91 @@ export interface Options extends Linter.Config {
|
|
|
18
18
|
*/
|
|
19
19
|
sort?: boolean;
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
22
|
-
*
|
|
21
|
+
* Controls Next plugin.
|
|
22
|
+
* @default true - If you have `next` in your dependencies.
|
|
23
23
|
*/
|
|
24
24
|
next?: boolean;
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
27
|
-
*
|
|
26
|
+
* Controls Tailwind plugin.
|
|
27
|
+
* @default true - If you have `tailwind` in your dependencies.
|
|
28
28
|
*/
|
|
29
29
|
tailwind?: boolean | { callees: string[] };
|
|
30
30
|
/**
|
|
31
|
+
* Controls [Node plugin](https://www.npmjs.com/package/eslint-plugin-n).
|
|
31
32
|
* @default false
|
|
32
|
-
* Controls [node plugin](https://www.npmjs.com/package/eslint-plugin-n).
|
|
33
33
|
*/
|
|
34
34
|
node?: boolean;
|
|
35
35
|
/**
|
|
36
|
-
* @default false
|
|
37
36
|
* Enables all strict rules.
|
|
37
|
+
* @default false
|
|
38
38
|
*/
|
|
39
39
|
strict?: boolean;
|
|
40
40
|
/**
|
|
41
|
-
* @default true
|
|
42
41
|
* Controls [import plugin](https://www.npmjs.com/package/eslint-plugin-import-x).
|
|
42
|
+
* @default true
|
|
43
43
|
*/
|
|
44
44
|
import?: boolean | { internalRegExp?: string; lifetime?: number; projects?: string | string[] };
|
|
45
45
|
/**
|
|
46
|
-
* @default true
|
|
46
|
+
* @default true - If you have `type: module` in your `package.json`.
|
|
47
47
|
*/
|
|
48
48
|
esm?: boolean;
|
|
49
49
|
/**
|
|
50
|
-
* @default true if you have one of `jest`, `vitest`, `cypress`, `playwright`, `storybook`, `prettier` in your dependencies.
|
|
51
50
|
* Controls [test plugin](https://www.npmjs.com/package/eslint-plugin-jest-formatting).
|
|
51
|
+
* @default true - If you have one of `jest`, `vitest`, `cypress`, `playwright`, `storybook`, `prettier` in your dependencies.
|
|
52
52
|
*/
|
|
53
53
|
test?: boolean;
|
|
54
54
|
/**
|
|
55
|
-
*
|
|
56
|
-
*
|
|
55
|
+
* Controls [Jest plugin](https://www.npmjs.com/package/eslint-plugin-jest).
|
|
56
|
+
* @default true - If you have `jest` in your dependencies.
|
|
57
57
|
*/
|
|
58
58
|
jest?: boolean;
|
|
59
59
|
/**
|
|
60
|
-
*
|
|
61
|
-
*
|
|
60
|
+
* Controls [Vitest plugin](https://www.npmjs.com/package/eslint-plugin-vitest).
|
|
61
|
+
* @default true - If you have `vitest` in your dependencies.
|
|
62
62
|
*/
|
|
63
63
|
vitest?: boolean;
|
|
64
64
|
/**
|
|
65
|
-
*
|
|
66
|
-
*
|
|
65
|
+
* Controls [Cypress plugin](https://www.npmjs.com/package/eslint-plugin-cypress).
|
|
66
|
+
* @default true - If you have `cypress` in your dependencies.
|
|
67
67
|
*/
|
|
68
68
|
cypress?: boolean;
|
|
69
69
|
/**
|
|
70
|
+
* Controls [Storybook plugin](https://www.npmjs.com/package/eslint-plugin-storybook).
|
|
70
71
|
* @default true if you have `storybook` in your dependencies.
|
|
71
|
-
* Controls [storybook plugin](https://www.npmjs.com/package/eslint-plugin-storybook).
|
|
72
72
|
*/
|
|
73
73
|
storybook?: boolean;
|
|
74
74
|
/**
|
|
75
|
-
*
|
|
76
|
-
*
|
|
75
|
+
* Controls [Prettier plugin](https://www.npmjs.com/package/eslint-plugin-prettier).
|
|
76
|
+
* @default true - If you have `prettier` in your dependencies.
|
|
77
77
|
*/
|
|
78
78
|
prettier?: boolean;
|
|
79
79
|
/**
|
|
80
|
-
*
|
|
81
|
-
*
|
|
80
|
+
* Controls [Playwright plugin](https://www.npmjs.com/package/eslint-plugin-playwright).
|
|
81
|
+
* @default true - If you have `playwright` in your dependencies.
|
|
82
82
|
*/
|
|
83
83
|
playwright?: boolean;
|
|
84
84
|
/**
|
|
85
|
-
*
|
|
86
|
-
*
|
|
85
|
+
* Controls [TypeScript plugin](https://www.npmjs.com/package/typescript-eslint).
|
|
86
|
+
* @default true - If you have `typescript` in your dependencies.
|
|
87
87
|
*/
|
|
88
88
|
typescript?: { projectService?: boolean | ProjectService; tsconfigRootDir: string; cacheLifetime?: number };
|
|
89
89
|
/**
|
|
90
|
-
* @default false
|
|
91
90
|
* Disables expensive rules.
|
|
91
|
+
* @default false
|
|
92
92
|
*/
|
|
93
93
|
disableExpensiveRules?: boolean;
|
|
94
94
|
/**
|
|
95
|
+
* List of globs to ignore
|
|
95
96
|
* @default []
|
|
96
|
-
* List of globs to ignore.
|
|
97
97
|
*/
|
|
98
98
|
ignores?: string[];
|
|
99
|
+
/**
|
|
100
|
+
* .gitignore file path relative to ESLint configuration file.
|
|
101
|
+
* @default './.gitignore'
|
|
102
|
+
*/
|
|
103
|
+
gitignorePath?: string;
|
|
99
104
|
}
|
|
100
105
|
|
|
101
|
-
export declare function defineConfig(
|
|
102
|
-
initOptions?: Options,
|
|
103
|
-
...extend: Linter.Config[]
|
|
104
|
-
): Linter.Config[];
|
|
106
|
+
export declare function defineConfig(initOptions?: Options, ...extend: Linter.Config[]): Linter.Config[];
|
|
105
107
|
|
|
106
108
|
export declare const init: typeof defineConfig;
|
package/cjs/index.js
CHANGED
|
@@ -39,6 +39,7 @@ const defaultOptions = {
|
|
|
39
39
|
disableExpensiveRules: false,
|
|
40
40
|
esm: false,
|
|
41
41
|
ignores: [],
|
|
42
|
+
gitignorePath: './.gitignore',
|
|
42
43
|
import: {},
|
|
43
44
|
jest: (0, _localPkg.isPackageExists)('jest'),
|
|
44
45
|
next: (0, _localPkg.isPackageExists)('next'),
|
|
@@ -78,6 +79,7 @@ function defineConfig(initOptions = {}, ...extend) {
|
|
|
78
79
|
disableExpensiveRules,
|
|
79
80
|
esm: enableEsm,
|
|
80
81
|
ignores: enableIgnores,
|
|
82
|
+
gitignorePath,
|
|
81
83
|
import: enableImport,
|
|
82
84
|
jest: enableJest,
|
|
83
85
|
next: enableNext,
|
|
@@ -113,5 +115,5 @@ function defineConfig(initOptions = {}, ...extend) {
|
|
|
113
115
|
return (0, _config.defineConfig)(rules);
|
|
114
116
|
}
|
|
115
117
|
|
|
116
|
-
/** @deprecated Please use `defineConfig` from `@fullstacksjs/eslint-config` instead, this function will be removed in the next major release */
|
|
118
|
+
/** @deprecated Please use `defineConfig` from `@fullstacksjs/eslint-config` instead, this function will be removed in the next major release. */
|
|
117
119
|
const init = exports.init = defineConfig;
|
package/cjs/modules/ignore.js
CHANGED
|
@@ -4,13 +4,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
|
|
7
|
+
var _compat = require("@eslint/compat");
|
|
7
8
|
var _config = require("eslint/config");
|
|
9
|
+
var _nodePath = _interopRequireDefault(require("node:path"));
|
|
8
10
|
var _globs = require("../utils/globs.js");
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
12
|
/**
|
|
10
13
|
* @param { import('../index.js').Options } options
|
|
11
14
|
* @return { import('eslint').Linter.Config }
|
|
12
15
|
*/
|
|
13
16
|
function ignores(options = {}) {
|
|
14
|
-
|
|
17
|
+
const gitignorePath = _nodePath.default.resolve(process.cwd(), options.gitignorePath);
|
|
18
|
+
const gitignore = (0, _compat.includeIgnoreFile)(gitignorePath);
|
|
19
|
+
return (0, _config.globalIgnores)([...gitignore.ignores, ..._globs.ignoreGlobs, ...(options.ignores ?? [])], 'ignores');
|
|
15
20
|
}
|
|
16
21
|
module.exports = ignores;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fullstacksjs/eslint-config",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.4.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "fullstacks <fullstacksjs@gmail.com>",
|
|
6
6
|
"description": "fullstacks eslint config",
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@eslint-react/eslint-plugin": "1.50.0",
|
|
39
|
+
"@eslint/compat": "1.3.0",
|
|
39
40
|
"@next/eslint-plugin-next": "15.3.2",
|
|
40
41
|
"@stylistic/eslint-plugin": "4.4.0",
|
|
41
42
|
"deepmerge": "4.3.1",
|
package/src/index.d.ts
CHANGED
|
@@ -9,8 +9,8 @@ interface ProjectService {
|
|
|
9
9
|
|
|
10
10
|
export interface Options extends Linter.Config {
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
12
|
+
* Controls React plugin.
|
|
13
|
+
* @default true - If you have `react` or `react-dom` in your dependencies.
|
|
14
14
|
*/
|
|
15
15
|
react?: boolean;
|
|
16
16
|
/**
|
|
@@ -18,89 +18,91 @@ export interface Options extends Linter.Config {
|
|
|
18
18
|
*/
|
|
19
19
|
sort?: boolean;
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
22
|
-
*
|
|
21
|
+
* Controls Next plugin.
|
|
22
|
+
* @default true - If you have `next` in your dependencies.
|
|
23
23
|
*/
|
|
24
24
|
next?: boolean;
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
27
|
-
*
|
|
26
|
+
* Controls Tailwind plugin.
|
|
27
|
+
* @default true - If you have `tailwind` in your dependencies.
|
|
28
28
|
*/
|
|
29
29
|
tailwind?: boolean | { callees: string[] };
|
|
30
30
|
/**
|
|
31
|
+
* Controls [Node plugin](https://www.npmjs.com/package/eslint-plugin-n).
|
|
31
32
|
* @default false
|
|
32
|
-
* Controls [node plugin](https://www.npmjs.com/package/eslint-plugin-n).
|
|
33
33
|
*/
|
|
34
34
|
node?: boolean;
|
|
35
35
|
/**
|
|
36
|
-
* @default false
|
|
37
36
|
* Enables all strict rules.
|
|
37
|
+
* @default false
|
|
38
38
|
*/
|
|
39
39
|
strict?: boolean;
|
|
40
40
|
/**
|
|
41
|
-
* @default true
|
|
42
41
|
* Controls [import plugin](https://www.npmjs.com/package/eslint-plugin-import-x).
|
|
42
|
+
* @default true
|
|
43
43
|
*/
|
|
44
44
|
import?: boolean | { internalRegExp?: string; lifetime?: number; projects?: string | string[] };
|
|
45
45
|
/**
|
|
46
|
-
* @default true
|
|
46
|
+
* @default true - If you have `type: module` in your `package.json`.
|
|
47
47
|
*/
|
|
48
48
|
esm?: boolean;
|
|
49
49
|
/**
|
|
50
|
-
* @default true if you have one of `jest`, `vitest`, `cypress`, `playwright`, `storybook`, `prettier` in your dependencies.
|
|
51
50
|
* Controls [test plugin](https://www.npmjs.com/package/eslint-plugin-jest-formatting).
|
|
51
|
+
* @default true - If you have one of `jest`, `vitest`, `cypress`, `playwright`, `storybook`, `prettier` in your dependencies.
|
|
52
52
|
*/
|
|
53
53
|
test?: boolean;
|
|
54
54
|
/**
|
|
55
|
-
*
|
|
56
|
-
*
|
|
55
|
+
* Controls [Jest plugin](https://www.npmjs.com/package/eslint-plugin-jest).
|
|
56
|
+
* @default true - If you have `jest` in your dependencies.
|
|
57
57
|
*/
|
|
58
58
|
jest?: boolean;
|
|
59
59
|
/**
|
|
60
|
-
*
|
|
61
|
-
*
|
|
60
|
+
* Controls [Vitest plugin](https://www.npmjs.com/package/eslint-plugin-vitest).
|
|
61
|
+
* @default true - If you have `vitest` in your dependencies.
|
|
62
62
|
*/
|
|
63
63
|
vitest?: boolean;
|
|
64
64
|
/**
|
|
65
|
-
*
|
|
66
|
-
*
|
|
65
|
+
* Controls [Cypress plugin](https://www.npmjs.com/package/eslint-plugin-cypress).
|
|
66
|
+
* @default true - If you have `cypress` in your dependencies.
|
|
67
67
|
*/
|
|
68
68
|
cypress?: boolean;
|
|
69
69
|
/**
|
|
70
|
+
* Controls [Storybook plugin](https://www.npmjs.com/package/eslint-plugin-storybook).
|
|
70
71
|
* @default true if you have `storybook` in your dependencies.
|
|
71
|
-
* Controls [storybook plugin](https://www.npmjs.com/package/eslint-plugin-storybook).
|
|
72
72
|
*/
|
|
73
73
|
storybook?: boolean;
|
|
74
74
|
/**
|
|
75
|
-
*
|
|
76
|
-
*
|
|
75
|
+
* Controls [Prettier plugin](https://www.npmjs.com/package/eslint-plugin-prettier).
|
|
76
|
+
* @default true - If you have `prettier` in your dependencies.
|
|
77
77
|
*/
|
|
78
78
|
prettier?: boolean;
|
|
79
79
|
/**
|
|
80
|
-
*
|
|
81
|
-
*
|
|
80
|
+
* Controls [Playwright plugin](https://www.npmjs.com/package/eslint-plugin-playwright).
|
|
81
|
+
* @default true - If you have `playwright` in your dependencies.
|
|
82
82
|
*/
|
|
83
83
|
playwright?: boolean;
|
|
84
84
|
/**
|
|
85
|
-
*
|
|
86
|
-
*
|
|
85
|
+
* Controls [TypeScript plugin](https://www.npmjs.com/package/typescript-eslint).
|
|
86
|
+
* @default true - If you have `typescript` in your dependencies.
|
|
87
87
|
*/
|
|
88
88
|
typescript?: { projectService?: boolean | ProjectService; tsconfigRootDir: string; cacheLifetime?: number };
|
|
89
89
|
/**
|
|
90
|
-
* @default false
|
|
91
90
|
* Disables expensive rules.
|
|
91
|
+
* @default false
|
|
92
92
|
*/
|
|
93
93
|
disableExpensiveRules?: boolean;
|
|
94
94
|
/**
|
|
95
|
+
* List of globs to ignore
|
|
95
96
|
* @default []
|
|
96
|
-
* List of globs to ignore.
|
|
97
97
|
*/
|
|
98
98
|
ignores?: string[];
|
|
99
|
+
/**
|
|
100
|
+
* .gitignore file path relative to ESLint configuration file.
|
|
101
|
+
* @default './.gitignore'
|
|
102
|
+
*/
|
|
103
|
+
gitignorePath?: string;
|
|
99
104
|
}
|
|
100
105
|
|
|
101
|
-
export declare function defineConfig(
|
|
102
|
-
initOptions?: Options,
|
|
103
|
-
...extend: Linter.Config[]
|
|
104
|
-
): Linter.Config[];
|
|
106
|
+
export declare function defineConfig(initOptions?: Options, ...extend: Linter.Config[]): Linter.Config[];
|
|
105
107
|
|
|
106
108
|
export declare const init: typeof defineConfig;
|
package/src/index.mjs
CHANGED
|
@@ -33,6 +33,7 @@ const defaultOptions = {
|
|
|
33
33
|
disableExpensiveRules: false,
|
|
34
34
|
esm: false,
|
|
35
35
|
ignores: [],
|
|
36
|
+
gitignorePath: './.gitignore',
|
|
36
37
|
import: {},
|
|
37
38
|
jest: isPackageExists('jest'),
|
|
38
39
|
next: isPackageExists('next'),
|
|
@@ -71,6 +72,7 @@ export function defineConfig(initOptions = {}, ...extend) {
|
|
|
71
72
|
disableExpensiveRules,
|
|
72
73
|
esm: enableEsm,
|
|
73
74
|
ignores: enableIgnores,
|
|
75
|
+
gitignorePath,
|
|
74
76
|
import: enableImport,
|
|
75
77
|
jest: enableJest,
|
|
76
78
|
next: enableNext,
|
|
@@ -110,5 +112,5 @@ export function defineConfig(initOptions = {}, ...extend) {
|
|
|
110
112
|
return eslintConfig(rules);
|
|
111
113
|
}
|
|
112
114
|
|
|
113
|
-
/** @deprecated Please use `defineConfig` from `@fullstacksjs/eslint-config` instead, this function will be removed in the next major release */
|
|
115
|
+
/** @deprecated Please use `defineConfig` from `@fullstacksjs/eslint-config` instead, this function will be removed in the next major release. */
|
|
114
116
|
export const init = defineConfig;
|
package/src/modules/ignore.mjs
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
|
+
import { includeIgnoreFile } from '@eslint/compat';
|
|
1
2
|
import { globalIgnores } from 'eslint/config';
|
|
3
|
+
import path from 'node:path';
|
|
2
4
|
|
|
3
5
|
import { ignoreGlobs } from '../utils/globs.mjs';
|
|
6
|
+
|
|
4
7
|
/**
|
|
5
8
|
* @param { import('..').Options } options
|
|
6
9
|
* @return { import('eslint').Linter.Config }
|
|
7
10
|
*/
|
|
8
11
|
function ignores(options = {}) {
|
|
9
|
-
|
|
12
|
+
const gitignorePath = path.resolve(process.cwd(), options.gitignorePath);
|
|
13
|
+
const gitignore = includeIgnoreFile(gitignorePath);
|
|
14
|
+
return globalIgnores([...gitignore.ignores, ...ignoreGlobs, ...(options.ignores ?? [])], 'ignores');
|
|
10
15
|
}
|
|
11
16
|
|
|
12
17
|
export default ignores;
|