@fullstacksjs/eslint-config 14.5.0 → 14.7.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 +95 -60
- package/cjs/index.js +12 -2
- package/cjs/modules/base.js +6 -2
- package/cjs/modules/cypress.js +10 -3
- package/cjs/modules/ignore.js +1 -1
- package/cjs/modules/imports.js +6 -3
- package/cjs/modules/jest.js +6 -2
- package/cjs/modules/next.js +10 -3
- package/cjs/modules/node.js +7 -3
- package/cjs/modules/perfectionist.js +8 -3
- package/cjs/modules/playwright.js +10 -3
- package/cjs/modules/prettier.js +10 -9
- package/cjs/modules/promise.js +9 -2
- package/cjs/modules/react.js +51 -29
- package/cjs/modules/regex.js +11 -3
- package/cjs/modules/storybook.js +10 -3
- package/cjs/modules/stylistic.js +7 -3
- package/cjs/modules/tailwind.js +13 -4
- package/cjs/modules/tests.js +6 -2
- package/cjs/modules/typescript.js +7 -13
- package/cjs/modules/vitest.js +7 -3
- package/cjs/{index.d.ts → types/index.d.ts} +50 -52
- package/cjs/types/modules/import.d.ts +7 -0
- package/cjs/types/modules/react.d.ts +10 -0
- package/cjs/types/modules/regex.d.ts +5 -0
- package/cjs/types/modules/tailwind.d.ts +13 -0
- package/cjs/types/modules/typescript.d.ts +38 -0
- package/cjs/utils/nextAllowExportNames.js +7 -0
- package/cjs/utils/objectOrEmpty.js +14 -0
- package/package.json +15 -14
- package/src/index.mjs +12 -2
- package/src/modules/base.mjs +8 -2
- package/src/modules/cypress.mjs +12 -3
- package/src/modules/ignore.mjs +1 -1
- package/src/modules/imports.mjs +6 -3
- package/src/modules/jest.mjs +7 -2
- package/src/modules/next.mjs +13 -3
- package/src/modules/node.mjs +9 -3
- package/src/modules/perfectionist.mjs +11 -3
- package/src/modules/playwright.mjs +12 -3
- package/src/modules/prettier.mjs +13 -9
- package/src/modules/promise.mjs +11 -2
- package/src/modules/react.mjs +55 -28
- package/src/modules/regex.mjs +14 -3
- package/src/modules/storybook.mjs +12 -3
- package/src/modules/stylistic.mjs +9 -3
- package/src/modules/tailwind.mjs +17 -5
- package/src/modules/tests.mjs +8 -2
- package/src/modules/typescript.mjs +7 -9
- package/src/modules/vitest.mjs +9 -3
- package/src/{index.d.ts → types/index.d.ts} +50 -52
- package/src/types/modules/import.d.ts +7 -0
- package/src/types/modules/react.d.ts +10 -0
- package/src/types/modules/regex.d.ts +5 -0
- package/src/types/modules/tailwind.d.ts +13 -0
- package/src/types/modules/typescript.d.ts +38 -0
- package/src/utils/nextAllowExportNames.mjs +17 -0
- package/src/utils/objectOrEmpty.mjs +8 -0
package/cjs/modules/promise.js
CHANGED
|
@@ -4,12 +4,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
|
|
7
|
+
var _eslintFlatConfigUtils = require("eslint-flat-config-utils");
|
|
7
8
|
var _eslintPluginPromise = _interopRequireDefault(require("eslint-plugin-promise"));
|
|
8
9
|
var _conditions = require("../utils/conditions.js");
|
|
10
|
+
var _objectOrEmpty = require("../utils/objectOrEmpty.js");
|
|
9
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* @param { import('../types').Options } options
|
|
14
|
+
* @return { Promise<import('eslint').Linter.Config> }
|
|
15
|
+
*/
|
|
11
16
|
function promise(options = {}) {
|
|
12
|
-
|
|
17
|
+
const overrides = (0, _objectOrEmpty.objectOrEmpty)(options.promise.overrides);
|
|
18
|
+
const promiseConfig = {
|
|
13
19
|
name: 'promise',
|
|
14
20
|
plugins: {
|
|
15
21
|
promise: _eslintPluginPromise.default
|
|
@@ -34,5 +40,6 @@ function promise(options = {}) {
|
|
|
34
40
|
'promise/spec-only': 'warn'
|
|
35
41
|
}
|
|
36
42
|
};
|
|
43
|
+
return (0, _eslintFlatConfigUtils.mergeConfigs)(promiseConfig, overrides);
|
|
37
44
|
}
|
|
38
45
|
module.exports = promise;
|
package/cjs/modules/react.js
CHANGED
|
@@ -5,22 +5,31 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
|
|
7
7
|
var _eslintPlugin = _interopRequireDefault(require("@eslint-react/eslint-plugin"));
|
|
8
|
+
var _eslintFlatConfigUtils = require("eslint-flat-config-utils");
|
|
8
9
|
var _eslintPluginJsxA11y = _interopRequireDefault(require("eslint-plugin-jsx-a11y"));
|
|
9
|
-
var
|
|
10
|
+
var _eslintPluginReactRefresh = require("eslint-plugin-react-refresh");
|
|
11
|
+
var _localPkg = require("local-pkg");
|
|
10
12
|
var _typescriptEslint = require("typescript-eslint");
|
|
11
13
|
var _conditions = require("../utils/conditions.js");
|
|
12
14
|
var _globs = require("../utils/globs.js");
|
|
15
|
+
var _nextAllowExportNames = require("../utils/nextAllowExportNames.js");
|
|
16
|
+
var _objectOrEmpty = require("../utils/objectOrEmpty.js");
|
|
13
17
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* @param { import('../types').Options } options
|
|
20
|
+
* @return { Promise<import('eslint').Linter.Config> }
|
|
21
|
+
*/
|
|
15
22
|
function react(options = {}) {
|
|
16
23
|
const projectService = options.typescript && options.typescript.tsconfigRootDir && options.typescript.projectService;
|
|
17
|
-
|
|
24
|
+
const isObject = typeof options.react === 'object';
|
|
25
|
+
const overrides = (0, _objectOrEmpty.objectOrEmpty)(options.react.overrides);
|
|
26
|
+
const reactConfig = {
|
|
18
27
|
name: 'react',
|
|
19
28
|
files: [_globs.globs.js, _globs.globs.jsx, _globs.globs.ts, _globs.globs.tsx],
|
|
20
29
|
plugins: {
|
|
21
30
|
..._eslintPlugin.default.configs.all.plugins,
|
|
22
|
-
'
|
|
23
|
-
'
|
|
31
|
+
'jsx-a11y': _eslintPluginJsxA11y.default,
|
|
32
|
+
'react-refresh': _eslintPluginReactRefresh.reactRefresh.plugin
|
|
24
33
|
},
|
|
25
34
|
...(0, _conditions.predicate)(projectService, {
|
|
26
35
|
languageOptions: {
|
|
@@ -31,12 +40,25 @@ function react(options = {}) {
|
|
|
31
40
|
}
|
|
32
41
|
}),
|
|
33
42
|
settings: {
|
|
34
|
-
'react': {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
43
|
+
'react-x': {
|
|
44
|
+
...(0, _conditions.predicate)(isObject && 'version' in options.react, {
|
|
45
|
+
version: options.react.version
|
|
46
|
+
}),
|
|
47
|
+
...(0, _conditions.predicate)(isObject && 'importSource' in options.react, {
|
|
48
|
+
importSource: options.react.importSource
|
|
49
|
+
}),
|
|
50
|
+
...(0, _conditions.predicate)(isObject && 'compilationMode' in options.react, {
|
|
51
|
+
compilationMode: options.react.compilationMode
|
|
52
|
+
}),
|
|
53
|
+
...(0, _conditions.predicate)(isObject && 'polymorphicPropName' in options.react, {
|
|
54
|
+
polymorphicPropName: options.react.polymorphicPropName
|
|
55
|
+
}),
|
|
56
|
+
...(0, _conditions.predicate)(isObject && 'additionalStateHooks' in options.react, {
|
|
57
|
+
additionalStateHooks: options.react.additionalStateHooks
|
|
58
|
+
}),
|
|
59
|
+
...(0, _conditions.predicate)(isObject && 'additionalEffectHooks' in options.react, {
|
|
60
|
+
additionalEffectHooks: options.react.additionalEffectHooks
|
|
61
|
+
})
|
|
40
62
|
}
|
|
41
63
|
},
|
|
42
64
|
rules: {
|
|
@@ -108,23 +130,18 @@ function react(options = {}) {
|
|
|
108
130
|
'@eslint-react/web-api-no-leaked-resize-observer': 'error',
|
|
109
131
|
'@eslint-react/web-api-no-leaked-fetch': 'error',
|
|
110
132
|
'@eslint-react/rsc-function-definition': 'error',
|
|
111
|
-
'react
|
|
112
|
-
'react
|
|
113
|
-
'react-
|
|
114
|
-
'react
|
|
115
|
-
'react
|
|
116
|
-
'react
|
|
117
|
-
'react
|
|
118
|
-
'react-
|
|
119
|
-
'react
|
|
120
|
-
'react-
|
|
121
|
-
'react-
|
|
122
|
-
'react
|
|
123
|
-
'react-hooks/set-state-in-render': 'error',
|
|
124
|
-
'react-hooks/static-components': (0, _conditions.strict)('error'),
|
|
125
|
-
'react-hooks/unsupported-syntax': 'warn',
|
|
126
|
-
'react-hooks/use-memo': 'error',
|
|
127
|
-
'react-hooks/incompatible-library': 'warn',
|
|
133
|
+
'@eslint-react/rules-of-hooks': 'error',
|
|
134
|
+
'@eslint-react/exhaustive-deps': 'error',
|
|
135
|
+
'@eslint-react/error-boundaries': 'error',
|
|
136
|
+
'@eslint-react/globals': 'error',
|
|
137
|
+
'@eslint-react/immutability': 'error',
|
|
138
|
+
'@eslint-react/purity': 'error',
|
|
139
|
+
'@eslint-react/refs': 'error',
|
|
140
|
+
'@eslint-react/set-state-in-effect': (0, _conditions.strict)('error'),
|
|
141
|
+
'@eslint-react/set-state-in-render': 'error',
|
|
142
|
+
'@eslint-react/static-components': (0, _conditions.strict)('error'),
|
|
143
|
+
'@eslint-react/unsupported-syntax': 'error',
|
|
144
|
+
'@eslint-react/use-memo': 'error',
|
|
128
145
|
'jsx-a11y/alt-text': 'warn',
|
|
129
146
|
'jsx-a11y/anchor-has-content': 'error',
|
|
130
147
|
'jsx-a11y/anchor-is-valid': 'error',
|
|
@@ -160,8 +177,13 @@ function react(options = {}) {
|
|
|
160
177
|
'jsx-a11y/scope': 'error',
|
|
161
178
|
'jsx-a11y/tabindex-no-positive': 'warn',
|
|
162
179
|
'jsx-a11y/anchor-ambiguous-text': 'off',
|
|
163
|
-
'jsx-a11y/prefer-tag-over-role': 'off'
|
|
180
|
+
'jsx-a11y/prefer-tag-over-role': 'off',
|
|
181
|
+
'react-refresh/only-export-components': ['error', {
|
|
182
|
+
allowExportNames: (0, _localPkg.isPackageExists)('next') ? _nextAllowExportNames.nextAllowExportNames : [],
|
|
183
|
+
allowConstantExport: (0, _localPkg.isPackageExists)('vite')
|
|
184
|
+
}]
|
|
164
185
|
}
|
|
165
186
|
};
|
|
187
|
+
return (0, _eslintFlatConfigUtils.mergeConfigs)(reactConfig, overrides);
|
|
166
188
|
}
|
|
167
189
|
module.exports = react;
|
package/cjs/modules/regex.js
CHANGED
|
@@ -4,22 +4,29 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
|
|
7
|
+
var _eslintFlatConfigUtils = require("eslint-flat-config-utils");
|
|
7
8
|
var plugin = _interopRequireWildcard(require("eslint-plugin-regexp"));
|
|
9
|
+
var _conditions = require("../utils/conditions.js");
|
|
10
|
+
var _objectOrEmpty = require("../utils/objectOrEmpty.js");
|
|
8
11
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
9
12
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
10
13
|
/**
|
|
11
|
-
* @param { import('../
|
|
14
|
+
* @param { import('../types').Options } options
|
|
12
15
|
* @return { Promise<import('eslint').Linter.Config> }
|
|
13
16
|
*/
|
|
14
17
|
function regex(options = {}) {
|
|
15
|
-
|
|
18
|
+
const isObject = typeof options.regex === 'object';
|
|
19
|
+
const overrides = (0, _objectOrEmpty.objectOrEmpty)(options.regex.overrides);
|
|
20
|
+
const regexConfig = {
|
|
16
21
|
name: 'regex',
|
|
17
22
|
plugins: {
|
|
18
23
|
regexp: plugin
|
|
19
24
|
},
|
|
20
25
|
settings: {
|
|
21
26
|
regexp: {
|
|
22
|
-
allowedCharacterRanges
|
|
27
|
+
...(0, _conditions.predicate)(isObject && 'allowedCharacterRanges' in options.regex, {
|
|
28
|
+
allowedCharacterRanges: options.regex.allowedCharacterRanges
|
|
29
|
+
})
|
|
23
30
|
}
|
|
24
31
|
},
|
|
25
32
|
rules: {
|
|
@@ -110,5 +117,6 @@ function regex(options = {}) {
|
|
|
110
117
|
'no-empty-character-class': 'off'
|
|
111
118
|
}
|
|
112
119
|
};
|
|
120
|
+
return (0, _eslintFlatConfigUtils.mergeConfigs)(regexConfig, overrides);
|
|
113
121
|
}
|
|
114
122
|
module.exports = regex;
|
package/cjs/modules/storybook.js
CHANGED
|
@@ -4,12 +4,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
|
|
7
|
+
var _eslintFlatConfigUtils = require("eslint-flat-config-utils");
|
|
7
8
|
var _eslintPluginStorybook = _interopRequireDefault(require("eslint-plugin-storybook"));
|
|
8
9
|
var _globs = require("../utils/globs.js");
|
|
10
|
+
var _objectOrEmpty = require("../utils/objectOrEmpty.js");
|
|
9
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
-
/**
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
/**
|
|
13
|
+
* @param { import('../types').Options } options
|
|
14
|
+
* @return { Promise<import('eslint').Linter.Config> }
|
|
15
|
+
*/
|
|
16
|
+
function storybook(options = {}) {
|
|
17
|
+
const overrides = (0, _objectOrEmpty.objectOrEmpty)(options.storybook.overrides);
|
|
18
|
+
const storybookConfig = {
|
|
13
19
|
name: 'storybook',
|
|
14
20
|
files: _globs.globs.storybook,
|
|
15
21
|
plugins: {
|
|
@@ -38,5 +44,6 @@ function storybook() {
|
|
|
38
44
|
'react-hooks/rules-of-hooks': 'off'
|
|
39
45
|
}
|
|
40
46
|
};
|
|
47
|
+
return (0, _eslintFlatConfigUtils.mergeConfigs)(storybookConfig, overrides);
|
|
41
48
|
}
|
|
42
49
|
module.exports = storybook;
|
package/cjs/modules/stylistic.js
CHANGED
|
@@ -5,13 +5,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
|
|
7
7
|
var _eslintPlugin = _interopRequireDefault(require("@stylistic/eslint-plugin"));
|
|
8
|
+
var _eslintFlatConfigUtils = require("eslint-flat-config-utils");
|
|
9
|
+
var _objectOrEmpty = require("../utils/objectOrEmpty.js");
|
|
8
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
11
|
/**
|
|
10
|
-
* @param { import('../
|
|
12
|
+
* @param { import('../types').Options } options
|
|
11
13
|
* @return { Promise<import('eslint').Linter.Config> }
|
|
12
14
|
*/
|
|
13
|
-
function stylistic() {
|
|
14
|
-
|
|
15
|
+
function stylistic(options = {}) {
|
|
16
|
+
const overrides = (0, _objectOrEmpty.objectOrEmpty)(options.stylistic.overrides);
|
|
17
|
+
const stylisticConfig = {
|
|
15
18
|
name: 'stylistic',
|
|
16
19
|
plugins: {
|
|
17
20
|
'@stylistic': _eslintPlugin.default
|
|
@@ -86,5 +89,6 @@ function stylistic() {
|
|
|
86
89
|
}]
|
|
87
90
|
}
|
|
88
91
|
};
|
|
92
|
+
return (0, _eslintFlatConfigUtils.mergeConfigs)(stylisticConfig, overrides);
|
|
89
93
|
}
|
|
90
94
|
module.exports = stylistic;
|
package/cjs/modules/tailwind.js
CHANGED
|
@@ -4,22 +4,30 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
|
|
7
|
+
var _eslintFlatConfigUtils = require("eslint-flat-config-utils");
|
|
7
8
|
var _conditions = require("../utils/conditions.js");
|
|
9
|
+
var _objectOrEmpty = require("../utils/objectOrEmpty.js");
|
|
8
10
|
/**
|
|
9
|
-
* @param { import('../
|
|
11
|
+
* @param { import('../types').Options } options
|
|
10
12
|
* @return { Promise<import('eslint').Linter.Config> }
|
|
11
13
|
*/
|
|
12
14
|
async function tailwind(options = {}) {
|
|
13
15
|
const plugin = await Promise.resolve().then(() => require('eslint-plugin-better-tailwindcss'));
|
|
14
|
-
|
|
16
|
+
const isObject = typeof options.tailwind === 'object';
|
|
17
|
+
const overrides = (0, _objectOrEmpty.objectOrEmpty)(options.tailwind.overrides);
|
|
18
|
+
const tailwindConfig = {
|
|
15
19
|
name: 'tailwind',
|
|
16
20
|
plugins: {
|
|
17
21
|
'better-tailwindcss': plugin.default ?? plugin
|
|
18
22
|
},
|
|
19
23
|
settings: {
|
|
20
24
|
'better-tailwindcss': {
|
|
21
|
-
entryPoint
|
|
22
|
-
|
|
25
|
+
...(0, _conditions.predicate)(isObject && 'entryPoint' in options.tailwind, {
|
|
26
|
+
entryPoint: options.tailwind.entryPoint
|
|
27
|
+
}),
|
|
28
|
+
...(0, _conditions.predicate)(isObject && 'tailwindConfig' in options.tailwind, {
|
|
29
|
+
tailwindConfig: options.tailwind.tailwindConfig
|
|
30
|
+
}),
|
|
23
31
|
callees: [['^class|classnames|classNames|cva|ctl|clsx|cn|cns|cx|cc|clb|cnb|dcnb|objstr|tv|twJoin|twMerge$', [{
|
|
24
32
|
match: 'strings'
|
|
25
33
|
}]]]
|
|
@@ -42,5 +50,6 @@ async function tailwind(options = {}) {
|
|
|
42
50
|
'better-tailwindcss/no-unnecessary-whitespace': 'warn'
|
|
43
51
|
}
|
|
44
52
|
};
|
|
53
|
+
return (0, _eslintFlatConfigUtils.mergeConfigs)(tailwindConfig, overrides);
|
|
45
54
|
}
|
|
46
55
|
module.exports = tailwind;
|
package/cjs/modules/tests.js
CHANGED
|
@@ -5,17 +5,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
|
|
7
7
|
var _eslintPlugin = _interopRequireDefault(require("@vitest/eslint-plugin"));
|
|
8
|
+
var _eslintFlatConfigUtils = require("eslint-flat-config-utils");
|
|
8
9
|
var _globals = _interopRequireDefault(require("globals"));
|
|
9
10
|
var _conditions = require("../utils/conditions.js");
|
|
10
11
|
var _globs = require("../utils/globs.js");
|
|
12
|
+
var _objectOrEmpty = require("../utils/objectOrEmpty.js");
|
|
11
13
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
14
|
/**
|
|
13
|
-
* @param { import('../
|
|
15
|
+
* @param { import('../types').Options } options
|
|
14
16
|
* @return { import('eslint').Linter.Config }
|
|
15
17
|
*/
|
|
16
18
|
|
|
17
19
|
function tests(options = {}) {
|
|
18
|
-
|
|
20
|
+
const overrides = (0, _objectOrEmpty.objectOrEmpty)(options.test.overrides);
|
|
21
|
+
const testsConfug = {
|
|
19
22
|
name: 'tests',
|
|
20
23
|
files: [..._globs.globs.test, ..._globs.globs.e2e],
|
|
21
24
|
plugins: {
|
|
@@ -44,5 +47,6 @@ function tests(options = {}) {
|
|
|
44
47
|
})
|
|
45
48
|
}
|
|
46
49
|
};
|
|
50
|
+
return (0, _eslintFlatConfigUtils.mergeConfigs)(testsConfug, overrides);
|
|
47
51
|
}
|
|
48
52
|
module.exports = tests;
|
|
@@ -4,17 +4,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
|
|
7
|
+
var _eslintFlatConfigUtils = require("eslint-flat-config-utils");
|
|
7
8
|
var _typescriptEslint = require("typescript-eslint");
|
|
8
9
|
var _conditions = require("../utils/conditions.js");
|
|
9
10
|
var _globs = require("../utils/globs.js");
|
|
10
11
|
var _namingConvention = require("../utils/naming-convention.js");
|
|
12
|
+
var _objectOrEmpty = require("../utils/objectOrEmpty.js");
|
|
11
13
|
/**
|
|
12
|
-
* @param { import('../
|
|
14
|
+
* @param { import('../types').Options } options
|
|
13
15
|
* @return { import('eslint').Linter.Config }
|
|
14
16
|
*/
|
|
15
17
|
function typescript(options = {}) {
|
|
16
18
|
const projectService = options.typescript && options.typescript.tsconfigRootDir && options.typescript.projectService;
|
|
17
|
-
|
|
19
|
+
const overrides = (0, _objectOrEmpty.objectOrEmpty)(options.typescript.overrides);
|
|
20
|
+
const typescriptConfig = {
|
|
18
21
|
name: 'typescript',
|
|
19
22
|
files: [_globs.globs.ts, _globs.globs.tsx],
|
|
20
23
|
plugins: {
|
|
@@ -154,15 +157,9 @@ function typescript(options = {}) {
|
|
|
154
157
|
'@typescript-eslint/restrict-plus-operands': 'warn',
|
|
155
158
|
'@typescript-eslint/strict-boolean-expressions': 'off',
|
|
156
159
|
// Annoying
|
|
157
|
-
|
|
160
|
+
|
|
158
161
|
'@typescript-eslint/triple-slash-reference': 'error',
|
|
159
|
-
'@typescript-eslint/typedef': ['error', {
|
|
160
|
-
parameter: false,
|
|
161
|
-
arrowParameter: false,
|
|
162
|
-
variableDeclaration: false
|
|
163
|
-
}],
|
|
164
162
|
'@typescript-eslint/unified-signatures': 'error',
|
|
165
|
-
'@typescript-eslint/key-spacing': 'off',
|
|
166
163
|
...(0, _conditions.predicate)(projectService, {
|
|
167
164
|
'@typescript-eslint/await-thenable': 'error',
|
|
168
165
|
'@typescript-eslint/consistent-return': 'off',
|
|
@@ -257,7 +254,6 @@ function typescript(options = {}) {
|
|
|
257
254
|
'import/namespace': 'off',
|
|
258
255
|
'import/default': 'off',
|
|
259
256
|
'import/no-named-as-default-member': 'off',
|
|
260
|
-
'key-spacing': 'off',
|
|
261
257
|
'camelcase': 'off',
|
|
262
258
|
'default-param-last': 'off',
|
|
263
259
|
'init-declarations': 'off',
|
|
@@ -269,9 +265,6 @@ function typescript(options = {}) {
|
|
|
269
265
|
'no-unused-vars': 'off',
|
|
270
266
|
'no-use-before-define': 'off',
|
|
271
267
|
'no-useless-constructor': 'off',
|
|
272
|
-
'object-curly-spacing': 'off',
|
|
273
|
-
'padding-line-between-statements': 'off',
|
|
274
|
-
'space-before-blocks': 'off',
|
|
275
268
|
'dot-notation': 'off',
|
|
276
269
|
'no-throw-literal': 'off',
|
|
277
270
|
'require-await': 'off',
|
|
@@ -279,5 +272,6 @@ function typescript(options = {}) {
|
|
|
279
272
|
'no-duplicate-imports': 'off'
|
|
280
273
|
}
|
|
281
274
|
};
|
|
275
|
+
return (0, _eslintFlatConfigUtils.mergeConfigs)(typescriptConfig, overrides);
|
|
282
276
|
}
|
|
283
277
|
module.exports = typescript;
|
package/cjs/modules/vitest.js
CHANGED
|
@@ -5,13 +5,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
|
|
7
7
|
var _eslintPlugin = _interopRequireDefault(require("@vitest/eslint-plugin"));
|
|
8
|
+
var _eslintFlatConfigUtils = require("eslint-flat-config-utils");
|
|
8
9
|
var _globs = require("../utils/globs.js");
|
|
10
|
+
var _objectOrEmpty = require("../utils/objectOrEmpty.js");
|
|
9
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
12
|
/**
|
|
13
|
+
* @param { import('../types').Options } options
|
|
11
14
|
* @return { import('eslint').Linter.Config }
|
|
12
15
|
*/
|
|
13
|
-
function vitest() {
|
|
14
|
-
|
|
16
|
+
function vitest(options = {}) {
|
|
17
|
+
const overrides = (0, _objectOrEmpty.objectOrEmpty)(options.vitest.overrides);
|
|
18
|
+
const vitestConfig = {
|
|
15
19
|
name: 'vitest',
|
|
16
20
|
files: _globs.globs.test,
|
|
17
21
|
plugins: {
|
|
@@ -51,7 +55,6 @@ function vitest() {
|
|
|
51
55
|
'vitest/no-conditional-in-test': 'off',
|
|
52
56
|
'vitest/no-conditional-tests': 'warn',
|
|
53
57
|
'vitest/no-disabled-tests': 'warn',
|
|
54
|
-
'vitest/no-done-callback': 'off',
|
|
55
58
|
'vitest/no-duplicate-hooks': 'error',
|
|
56
59
|
'vitest/no-focused-tests': 'warn',
|
|
57
60
|
'vitest/no-hooks': 'off',
|
|
@@ -108,5 +111,6 @@ function vitest() {
|
|
|
108
111
|
'vitest/warn-todo': 'warn'
|
|
109
112
|
}
|
|
110
113
|
};
|
|
114
|
+
return (0, _eslintFlatConfigUtils.mergeConfigs)(vitestConfig, overrides);
|
|
111
115
|
}
|
|
112
116
|
module.exports = vitest;
|
|
@@ -1,69 +1,57 @@
|
|
|
1
1
|
import type { Linter } from 'eslint';
|
|
2
|
+
import type { ConfigWithExtends } from 'eslint-flat-config-utils';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
* Globs of files to allow running with the default project compiler options
|
|
9
|
-
* despite not being matched by the project service.
|
|
10
|
-
*/
|
|
11
|
-
allowDefaultProject?: string[];
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Path to a TSConfig to use instead of TypeScript's default project configuration.
|
|
15
|
-
* @default 'tsconfig.json'
|
|
16
|
-
*/
|
|
17
|
-
defaultProject?: string;
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Whether to allow TypeScript plugins as configured in the TSConfig.
|
|
21
|
-
*/
|
|
22
|
-
loadTypeScriptPlugins?: boolean;
|
|
4
|
+
import type { ImportOptions } from './modules/import';
|
|
5
|
+
import type { ReactOptions } from './modules/react';
|
|
6
|
+
import type { RegexOptions } from './modules/regex';
|
|
7
|
+
import type { TailwindOptions } from './modules/tailwind';
|
|
8
|
+
import type { TypeScriptOptions } from './modules/typescript';
|
|
23
9
|
|
|
10
|
+
interface ConfigWithOverrides {
|
|
24
11
|
/**
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
12
|
+
* Override the configuration.
|
|
13
|
+
*
|
|
14
|
+
* The properties of this object are merged with and take precedence over the default configuration.
|
|
15
|
+
*
|
|
16
|
+
* There is no guarantee that the resulting configuration works correctly — it depends on the options you provide.
|
|
17
|
+
*
|
|
18
|
+
* @see [eslint-flat-config-utils: `mergeConfigs`](https://jsr.io/@antfu/eslint-flat-config-utils/doc/~/mergeConfigs)
|
|
30
19
|
*/
|
|
31
|
-
|
|
20
|
+
overrides?: ConfigWithExtends;
|
|
32
21
|
}
|
|
33
22
|
|
|
34
|
-
type TailwindConfig = {
|
|
35
|
-
callees?: string[];
|
|
36
|
-
variables?: string[];
|
|
37
|
-
attributes?: string[];
|
|
38
|
-
tags?: string[];
|
|
39
|
-
} & ({ entryPoint: string; tailwindConfig?: string } | { entryPoint?: string; tailwindConfig: string });
|
|
40
|
-
|
|
41
23
|
export interface Options extends Linter.Config {
|
|
24
|
+
/**
|
|
25
|
+
* Controls Base.
|
|
26
|
+
* @default true
|
|
27
|
+
*/
|
|
28
|
+
base?: boolean | ConfigWithOverrides;
|
|
42
29
|
/**
|
|
43
30
|
* Controls React plugin.
|
|
44
31
|
* @default true - If you have `react` or `react-dom` in your dependencies.
|
|
45
32
|
*/
|
|
46
|
-
react?: boolean |
|
|
33
|
+
react?: boolean | ReactOptions;
|
|
47
34
|
/**
|
|
35
|
+
* Controls [Perfectionist plugin](https://www.npmjs.com/package/eslint-plugin-perfectionist).
|
|
48
36
|
* @default true
|
|
49
37
|
*/
|
|
50
|
-
sort?: boolean;
|
|
38
|
+
sort?: boolean | ConfigWithOverrides;
|
|
51
39
|
/**
|
|
52
40
|
* Controls Next plugin.
|
|
53
41
|
* @default true - If you have `next` in your dependencies.
|
|
54
42
|
*/
|
|
55
|
-
next?: boolean;
|
|
43
|
+
next?: boolean | ConfigWithOverrides;
|
|
56
44
|
/**
|
|
57
45
|
* Controls Tailwind plugin.
|
|
58
46
|
* @default false
|
|
59
47
|
* @see https://github.com/schoero/eslint-plugin-better-tailwindcss/blob/main/docs/settings/settings.md
|
|
60
48
|
*/
|
|
61
|
-
tailwind?: false |
|
|
49
|
+
tailwind?: false | TailwindOptions;
|
|
62
50
|
/**
|
|
63
51
|
* Controls [Node plugin](https://www.npmjs.com/package/eslint-plugin-n).
|
|
64
52
|
* @default false
|
|
65
53
|
*/
|
|
66
|
-
node?: boolean;
|
|
54
|
+
node?: boolean | ConfigWithOverrides;
|
|
67
55
|
/**
|
|
68
56
|
* Enables all strict rules.
|
|
69
57
|
* @default false
|
|
@@ -73,7 +61,7 @@ export interface Options extends Linter.Config {
|
|
|
73
61
|
* Controls [import plugin](https://www.npmjs.com/package/eslint-plugin-import-x).
|
|
74
62
|
* @default true
|
|
75
63
|
*/
|
|
76
|
-
import?: boolean |
|
|
64
|
+
import?: boolean | ImportOptions;
|
|
77
65
|
/**
|
|
78
66
|
* @default true - If you have `type: module` in your `package.json`.
|
|
79
67
|
*/
|
|
@@ -82,42 +70,57 @@ export interface Options extends Linter.Config {
|
|
|
82
70
|
* Controls [test plugin](https://www.npmjs.com/package/eslint-plugin-jest-formatting).
|
|
83
71
|
* @default true - If you have one of `jest`, `vitest`, `cypress`, `@playwright/test` in your dependencies.
|
|
84
72
|
*/
|
|
85
|
-
test?: boolean;
|
|
73
|
+
test?: boolean | ConfigWithOverrides;
|
|
86
74
|
/**
|
|
87
75
|
* Controls [Jest plugin](https://www.npmjs.com/package/eslint-plugin-jest).
|
|
88
76
|
* @default true - If you have `jest` in your dependencies.
|
|
89
77
|
*/
|
|
90
|
-
jest?: boolean;
|
|
78
|
+
jest?: boolean | ConfigWithOverrides;
|
|
91
79
|
/**
|
|
92
80
|
* Controls [Vitest plugin](https://www.npmjs.com/package/eslint-plugin-vitest).
|
|
93
81
|
* @default true - If you have `vitest` in your dependencies.
|
|
94
82
|
*/
|
|
95
|
-
vitest?: boolean;
|
|
83
|
+
vitest?: boolean | ConfigWithOverrides;
|
|
96
84
|
/**
|
|
97
85
|
* Controls [Cypress plugin](https://www.npmjs.com/package/eslint-plugin-cypress).
|
|
98
86
|
* @default true - If you have `cypress` in your dependencies.
|
|
99
87
|
*/
|
|
100
|
-
cypress?: boolean;
|
|
88
|
+
cypress?: boolean | ConfigWithOverrides;
|
|
101
89
|
/**
|
|
102
90
|
* Controls [Storybook plugin](https://www.npmjs.com/package/eslint-plugin-storybook).
|
|
103
91
|
* @default true if you have `storybook` in your dependencies.
|
|
104
92
|
*/
|
|
105
|
-
storybook?: boolean;
|
|
93
|
+
storybook?: boolean | ConfigWithOverrides;
|
|
106
94
|
/**
|
|
107
95
|
* Controls [Prettier plugin](https://www.npmjs.com/package/eslint-plugin-prettier).
|
|
108
96
|
* @default true - If you have `prettier` in your dependencies.
|
|
109
97
|
*/
|
|
110
|
-
prettier?: boolean;
|
|
98
|
+
prettier?: boolean | ConfigWithOverrides;
|
|
111
99
|
/**
|
|
112
100
|
* Controls [Playwright plugin](https://www.npmjs.com/package/eslint-plugin-playwright).
|
|
113
101
|
* @default true - If you have `@playwright/test` in your dependencies.
|
|
114
102
|
*/
|
|
115
|
-
playwright?: boolean;
|
|
103
|
+
playwright?: boolean | ConfigWithOverrides;
|
|
104
|
+
/**
|
|
105
|
+
* Controls [Promise plugin](https://www.npmjs.com/package/eslint-plugin-promise).
|
|
106
|
+
* @default true
|
|
107
|
+
*/
|
|
108
|
+
promise?: boolean | ConfigWithOverrides;
|
|
109
|
+
/**
|
|
110
|
+
* Controls [Stylistic plugin](https://www.npmjs.com/package/@stylistic/eslint-plugin).
|
|
111
|
+
* @default true
|
|
112
|
+
*/
|
|
113
|
+
stylistic?: boolean | ConfigWithOverrides;
|
|
116
114
|
/**
|
|
117
115
|
* Controls [TypeScript plugin](https://www.npmjs.com/package/typescript-eslint).
|
|
118
116
|
* @default true - If you have `typescript` in your dependencies.
|
|
119
117
|
*/
|
|
120
|
-
typescript?: boolean |
|
|
118
|
+
typescript?: boolean | TypeScriptOptions;
|
|
119
|
+
/**
|
|
120
|
+
* Controls [Regex plugin](https://www.npmjs.com/package/eslint-plugin-regexp).
|
|
121
|
+
* @default { allowedCharacterRanges: ['all'] }
|
|
122
|
+
*/
|
|
123
|
+
regex?: boolean | RegexOptions;
|
|
121
124
|
/**
|
|
122
125
|
* Disables expensive rules.
|
|
123
126
|
* @default false
|
|
@@ -133,11 +136,6 @@ export interface Options extends Linter.Config {
|
|
|
133
136
|
* @default './.gitignore'
|
|
134
137
|
*/
|
|
135
138
|
gitignore?: string | false;
|
|
136
|
-
/**
|
|
137
|
-
* Controls regex plugin.
|
|
138
|
-
* @default { allowedCharacterRanges: ['all'] }
|
|
139
|
-
*/
|
|
140
|
-
regex?: boolean | { allowedCharacterRanges: string[] };
|
|
141
139
|
}
|
|
142
140
|
|
|
143
141
|
export declare function defineConfig(initOptions?: Options, ...extend: Linter.Config[]): Linter.Config[];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ConfigWithOverrides } from '..';
|
|
2
|
+
|
|
3
|
+
interface ReactOptions extends ConfigWithOverrides {
|
|
4
|
+
version?: string;
|
|
5
|
+
importSource?: string;
|
|
6
|
+
compilationMode?: 'all' | 'annotation' | 'infer' | 'syntax'; // Use the same compilationMode as the React Compiler config for consistent analysis
|
|
7
|
+
polymorphicPropName?: string;
|
|
8
|
+
additionalStateHooks?: string;
|
|
9
|
+
additionalEffectHooks?: string;
|
|
10
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ConfigWithOverrides } from '..';
|
|
2
|
+
|
|
3
|
+
interface TailwindOptionsWithEntryPoint extends ConfigWithOverrides {
|
|
4
|
+
entryPoint: string;
|
|
5
|
+
tailwindConfig?: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
interface TailwindOptionsWithConfig extends ConfigWithOverrides {
|
|
9
|
+
entryPoint?: string;
|
|
10
|
+
tailwindConfig: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
type TailwindOptions = TailwindOptionsWithConfig | TailwindOptionsWithEntryPoint;
|