@elliemae/pui-cli 8.62.1 → 9.0.0-alpha.2
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 +33 -0
- package/dist/cjs/commands/test.js +0 -1
- package/dist/cjs/commands/utils.js +4 -4
- package/dist/cjs/commands/vitest.js +0 -1
- package/dist/cjs/index.cjs +12 -0
- package/dist/cjs/index.js +6 -0
- package/dist/cjs/lint-config/eslint/common.cjs +1 -1
- package/dist/cjs/lint-config/eslint/flat/common.mjs +167 -0
- package/dist/cjs/lint-config/eslint/flat/index.mjs +20 -0
- package/dist/cjs/lint-config/eslint/flat/non-react-export.mjs +10 -0
- package/dist/cjs/lint-config/eslint/flat/non-react.mjs +6 -0
- package/dist/cjs/lint-config/eslint/flat/presets.mjs +78 -0
- package/dist/cjs/lint-config/eslint/flat/react-export.mjs +7 -0
- package/dist/cjs/lint-config/eslint/flat/react.mjs +60 -0
- package/dist/cjs/lint-config/eslint/flat/rules.mjs +185 -0
- package/dist/cjs/lint-config/eslint/typescript/non-react.cjs +1 -1
- package/dist/cjs/lint-config/eslint/typescript/react.cjs +1 -1
- package/dist/cjs/monorepo/utils.cjs +2 -2
- package/dist/cjs/monorepo/utils.js +1 -1
- package/dist/cjs/testing/jest.config.cjs +5 -9
- package/dist/cjs/testing/resolver.cjs +1 -1
- package/dist/cjs/testing/setup-react-env.js +1 -1
- package/dist/cjs/transpile/esbuild.js +1 -1
- package/dist/cjs/webpack/csp-plugin.js +2 -4
- package/dist/cjs/webpack/prop-types-shim.js +0 -1
- package/dist/cjs/webpack/webpack.lib.base.babel.js +0 -8
- package/dist/esm/commands/test.js +0 -1
- package/dist/esm/commands/utils.js +4 -4
- package/dist/esm/commands/vitest.js +0 -1
- package/dist/esm/index.cjs +12 -0
- package/dist/esm/index.js +12 -0
- package/dist/esm/lint-config/eslint/common.cjs +1 -1
- package/dist/esm/lint-config/eslint/flat/common.mjs +167 -0
- package/dist/esm/lint-config/eslint/flat/index.mjs +20 -0
- package/dist/esm/lint-config/eslint/flat/non-react-export.mjs +10 -0
- package/dist/esm/lint-config/eslint/flat/non-react.mjs +6 -0
- package/dist/esm/lint-config/eslint/flat/presets.mjs +78 -0
- package/dist/esm/lint-config/eslint/flat/react-export.mjs +7 -0
- package/dist/esm/lint-config/eslint/flat/react.mjs +60 -0
- package/dist/esm/lint-config/eslint/flat/rules.mjs +185 -0
- package/dist/esm/lint-config/eslint/typescript/non-react.cjs +1 -1
- package/dist/esm/lint-config/eslint/typescript/react.cjs +1 -1
- package/dist/esm/monorepo/utils.cjs +2 -2
- package/dist/esm/monorepo/utils.js +1 -1
- package/dist/esm/testing/jest.config.cjs +5 -9
- package/dist/esm/testing/resolver.cjs +1 -1
- package/dist/esm/testing/setup-react-env.js +1 -1
- package/dist/esm/transpile/esbuild.js +1 -1
- package/dist/esm/webpack/csp-plugin.js +2 -4
- package/dist/esm/webpack/prop-types-shim.js +0 -1
- package/dist/esm/webpack/webpack.lib.base.babel.js +0 -8
- package/dist/types/docusaurus.config.d.ts +3 -2
- package/dist/types/lib/commands/build.d.ts +1 -1
- package/dist/types/lib/commands/buildcdn.d.ts +1 -1
- package/dist/types/lib/commands/codemod.d.ts +1 -1
- package/dist/types/lib/commands/gendoc.d.ts +1 -1
- package/dist/types/lib/commands/lint.d.ts +1 -1
- package/dist/types/lib/commands/pack.d.ts +1 -1
- package/dist/types/lib/commands/start.d.ts +1 -1
- package/dist/types/lib/commands/storybook.d.ts +1 -1
- package/dist/types/lib/commands/test.d.ts +1 -1
- package/dist/types/lib/commands/tscheck.d.ts +1 -1
- package/dist/types/lib/commands/version.d.ts +1 -1
- package/dist/types/lib/commands/vitest.d.ts +1 -1
- package/dist/types/lib/index.d.cts +5 -1
- package/dist/types/lib/index.d.ts +4 -0
- package/dist/types/lib/lint-config/eslint/flat/common.d.mts +6 -0
- package/dist/types/lib/lint-config/eslint/flat/index.d.mts +6 -0
- package/dist/types/lib/lint-config/eslint/flat/non-react-export.d.mts +4 -0
- package/dist/types/lib/lint-config/eslint/flat/non-react.d.mts +3 -0
- package/dist/types/lib/lint-config/eslint/flat/presets.d.mts +63 -0
- package/dist/types/lib/lint-config/eslint/flat/react-export.d.mts +4 -0
- package/dist/types/lib/lint-config/eslint/flat/react.d.mts +4 -0
- package/dist/types/lib/lint-config/eslint/flat/rules.d.mts +358 -0
- package/dist/types/lib/server/appRoutes.d.ts +1 -1
- package/dist/types/lib/server/csp.d.ts +1 -1
- package/dist/types/lib/server/middlewares.d.ts +1 -1
- package/dist/types/lib/webpack/csp-plugin.d.ts +3 -3
- package/dist/types/lib/webpack/helpers.d.ts +1 -1
- package/dist/types/lib/webpack/interceptor-middleware.d.ts +2 -2
- package/dist/types/lib/webpack/webpack.base.babel.d.ts +1 -1
- package/dist/types/lib/webpack/webpack.lib.base.babel.d.ts +1 -1
- package/dist/types/lib/webpack/webpack.lib.prod.babel.d.ts +1 -1
- package/dist/types/lib/webpack/webpack.prod.babel.d.ts +1 -1
- package/dist/types/lib/webpack/webpack.storybook.d.ts +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/lib/lint-config/commitlint.config.cjs +1 -0
- package/lib/lint-config/eslint/common.cjs +164 -0
- package/lib/lint-config/eslint/flat/common.mjs +167 -0
- package/lib/lint-config/eslint/flat/index.mjs +20 -0
- package/lib/lint-config/eslint/flat/non-react-export.mjs +10 -0
- package/lib/lint-config/eslint/flat/non-react.mjs +6 -0
- package/lib/lint-config/eslint/flat/presets.mjs +78 -0
- package/lib/lint-config/eslint/flat/react-export.mjs +7 -0
- package/lib/lint-config/eslint/flat/react.mjs +60 -0
- package/lib/lint-config/eslint/flat/rules.mjs +185 -0
- package/lib/lint-config/eslint/non-react.cjs +14 -0
- package/lib/lint-config/eslint/react.cjs +26 -0
- package/lib/lint-config/eslint/typescript/common.cjs +49 -0
- package/lib/lint-config/eslint/typescript/non-react.cjs +12 -0
- package/lib/lint-config/eslint/typescript/react.cjs +19 -0
- package/lib/lint-config/lint-staged.config.js +15 -0
- package/lib/lint-config/prettier.config.cjs +8 -0
- package/lib/lint-config/stylelint.config.cjs +19 -0
- package/package.json +35 -28
- package/dist/cjs/testing/setup-env.js +0 -8
- package/dist/esm/testing/setup-env.js +0 -7
- package/dist/types/lib/testing/setup-env.d.ts +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
exports.commitlintConfig = { extends: ['@commitlint/config-conventional'] };
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
|
|
2
|
+
const prettierOptions = require("../prettier.config.cjs");
|
|
3
|
+
// const webpackConfig = require('../../webpack/webpack.prod.babel');
|
|
4
|
+
|
|
5
|
+
exports.baseExtends = [
|
|
6
|
+
"plugin:eslint-comments/recommended",
|
|
7
|
+
"plugin:import/recommended",
|
|
8
|
+
"plugin:prettier/recommended",
|
|
9
|
+
"plugin:jest/recommended",
|
|
10
|
+
"plugin:jsdoc/recommended",
|
|
11
|
+
"plugin:wdio/recommended",
|
|
12
|
+
"plugin:testing-library/dom",
|
|
13
|
+
"plugin:storybook/recommended",
|
|
14
|
+
];
|
|
15
|
+
|
|
16
|
+
const basePlugins = ["testing-library", "jest", "jsdoc", "wdio", "import"];
|
|
17
|
+
exports.basePlugins = basePlugins;
|
|
18
|
+
|
|
19
|
+
exports.baseOverrides = [
|
|
20
|
+
{
|
|
21
|
+
files: ["*.func.spec.js", "*.visual.spec.js"],
|
|
22
|
+
rules: {
|
|
23
|
+
"jest/valid-expect": "off",
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
];
|
|
27
|
+
|
|
28
|
+
const baseRules = {
|
|
29
|
+
"prettier/prettier": ["error", prettierOptions],
|
|
30
|
+
"arrow-body-style": [2, "as-needed"],
|
|
31
|
+
"class-methods-use-this": 0,
|
|
32
|
+
"import/imports-first": 0,
|
|
33
|
+
"import/newline-after-import": 0,
|
|
34
|
+
"import/no-dynamic-require": 0,
|
|
35
|
+
"import/no-extraneous-dependencies": 0,
|
|
36
|
+
"import/no-named-as-default": 0,
|
|
37
|
+
"import/no-unresolved": [
|
|
38
|
+
2,
|
|
39
|
+
{ caseSensitive: true, caseSensitiveStrict: true },
|
|
40
|
+
], // Tip: https://github.com/import-js/eslint-plugin-import/issues/1868
|
|
41
|
+
"import/no-webpack-loader-syntax": 0,
|
|
42
|
+
"import/prefer-default-export": 0,
|
|
43
|
+
"import/extensions": [
|
|
44
|
+
2,
|
|
45
|
+
"never",
|
|
46
|
+
{
|
|
47
|
+
json: "ignorePackages",
|
|
48
|
+
js: "ignorePackages",
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
indent: [
|
|
52
|
+
2,
|
|
53
|
+
2,
|
|
54
|
+
{
|
|
55
|
+
SwitchCase: 1,
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
"max-lines": ["error", { max: 120, skipComments: true }],
|
|
59
|
+
complexity: ["error", { max: 10 }],
|
|
60
|
+
"max-depth": ["error", { max: 4 }],
|
|
61
|
+
"max-lines-per-function": 0,
|
|
62
|
+
"max-nested-callbacks": ["error", { max: 3 }],
|
|
63
|
+
"max-params": ["error", { max: 3 }],
|
|
64
|
+
"max-statements": ["error", { max: 20 }],
|
|
65
|
+
"max-len": 0,
|
|
66
|
+
"newline-per-chained-call": 0,
|
|
67
|
+
"no-confusing-arrow": 0,
|
|
68
|
+
"no-console": 1,
|
|
69
|
+
"no-param-reassign": ["error", { props: false }],
|
|
70
|
+
"no-unused-vars": 2,
|
|
71
|
+
"no-use-before-define": 0,
|
|
72
|
+
"prefer-template": 2,
|
|
73
|
+
"require-yield": 0,
|
|
74
|
+
"jsdoc/require-jsdoc": 0,
|
|
75
|
+
"eslint-comments/disable-enable-pair": 0,
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
exports.baseRules = baseRules;
|
|
79
|
+
|
|
80
|
+
const reactRules = {
|
|
81
|
+
"jsx-a11y/aria-props": 2,
|
|
82
|
+
"jsx-a11y/heading-has-content": 0,
|
|
83
|
+
"jsx-a11y/label-has-associated-control": [
|
|
84
|
+
2,
|
|
85
|
+
{
|
|
86
|
+
// NOTE: If this error triggers, either disable it or add
|
|
87
|
+
// your custom components, labels and attributes via these options
|
|
88
|
+
// See https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/label-has-associated-control.md
|
|
89
|
+
controlComponents: ["Input"],
|
|
90
|
+
},
|
|
91
|
+
],
|
|
92
|
+
"jsx-a11y/label-has-for": 0,
|
|
93
|
+
"jsx-a11y/mouse-events-have-key-events": 2,
|
|
94
|
+
"jsx-a11y/role-has-required-aria-props": 2,
|
|
95
|
+
"jsx-a11y/role-supports-aria-props": 2,
|
|
96
|
+
"react/destructuring-assignment": 0,
|
|
97
|
+
"react-hooks/rules-of-hooks": "error",
|
|
98
|
+
"react/jsx-closing-tag-location": 0,
|
|
99
|
+
"react/forbid-prop-types": 0,
|
|
100
|
+
"react/jsx-first-prop-new-line": [2, "multiline"],
|
|
101
|
+
"react/jsx-no-target-blank": 0,
|
|
102
|
+
"react/jsx-props-no-spreading": 0,
|
|
103
|
+
"react/jsx-uses-vars": 2,
|
|
104
|
+
"react/require-default-props": 0,
|
|
105
|
+
"react/require-extension": 0,
|
|
106
|
+
"react/self-closing-comp": 0,
|
|
107
|
+
"react/sort-comp": 0,
|
|
108
|
+
"react/react-in-jsx-scope": 0,
|
|
109
|
+
"react/jsx-filename-extension": [
|
|
110
|
+
1,
|
|
111
|
+
{ extensions: [".js", ".jsx", ".tsx", ".mdx"] },
|
|
112
|
+
],
|
|
113
|
+
"react/function-component-definition": [
|
|
114
|
+
2,
|
|
115
|
+
{ namedComponents: "arrow-function" },
|
|
116
|
+
],
|
|
117
|
+
"redux-saga/no-yield-in-race": 2,
|
|
118
|
+
"redux-saga/yield-effects": 2,
|
|
119
|
+
};
|
|
120
|
+
exports.reactRules = reactRules;
|
|
121
|
+
|
|
122
|
+
exports.baseConfig = {
|
|
123
|
+
parser: "@babel/eslint-parser",
|
|
124
|
+
plugins: basePlugins,
|
|
125
|
+
env: {
|
|
126
|
+
jest: true,
|
|
127
|
+
browser: true,
|
|
128
|
+
node: true,
|
|
129
|
+
es2021: true,
|
|
130
|
+
},
|
|
131
|
+
parserOptions: {
|
|
132
|
+
sourceType: "module",
|
|
133
|
+
ecmaFeatures: {
|
|
134
|
+
jsx: true,
|
|
135
|
+
},
|
|
136
|
+
babelOptions: {
|
|
137
|
+
plugins: ["@babel/plugin-syntax-import-assertions"],
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
settings: {
|
|
141
|
+
react: {
|
|
142
|
+
version: "detect",
|
|
143
|
+
},
|
|
144
|
+
jest: {
|
|
145
|
+
version: 28,
|
|
146
|
+
},
|
|
147
|
+
"import/resolver": {
|
|
148
|
+
node: {
|
|
149
|
+
extensions: [".js", ".jsx", ".ts", ".tsx"],
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
ignorePatterns: [
|
|
154
|
+
"/build/**/*",
|
|
155
|
+
"/node_modules/**/*",
|
|
156
|
+
"/dist/**/*",
|
|
157
|
+
"/reports/**/*",
|
|
158
|
+
"/coverage/**/*",
|
|
159
|
+
"/demo/**/*",
|
|
160
|
+
"/docs/**/*",
|
|
161
|
+
"/temp/**/*",
|
|
162
|
+
"**/vendor/*.js",
|
|
163
|
+
],
|
|
164
|
+
};
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import eslint from '@eslint/js';
|
|
2
|
+
import { defineConfig } from 'eslint/config';
|
|
3
|
+
import eslintConfigPrettier from 'eslint-config-prettier';
|
|
4
|
+
import eslintComments from 'eslint-plugin-eslint-comments';
|
|
5
|
+
import importX from 'eslint-plugin-import-x';
|
|
6
|
+
import jest from 'eslint-plugin-jest';
|
|
7
|
+
import testingLibrary from 'eslint-plugin-testing-library';
|
|
8
|
+
import wdio from 'eslint-plugin-wdio';
|
|
9
|
+
import globals from 'globals';
|
|
10
|
+
import tseslint from 'typescript-eslint';
|
|
11
|
+
import {
|
|
12
|
+
jestRecommendedRules,
|
|
13
|
+
sharedCoreRules,
|
|
14
|
+
storybookFiles,
|
|
15
|
+
testFiles,
|
|
16
|
+
testJsxFiles,
|
|
17
|
+
testingLibraryDomRules,
|
|
18
|
+
testingLibraryReactRules,
|
|
19
|
+
wdioGlobals,
|
|
20
|
+
wdioRecommendedRules,
|
|
21
|
+
wdioSpecFiles,
|
|
22
|
+
} from './presets.mjs';
|
|
23
|
+
import {
|
|
24
|
+
ignorePatterns,
|
|
25
|
+
jsRules,
|
|
26
|
+
typescriptRules,
|
|
27
|
+
typescriptStrictRules,
|
|
28
|
+
typescriptTestRelaxedRules,
|
|
29
|
+
} from './rules.mjs';
|
|
30
|
+
|
|
31
|
+
const tsconfigRootDir = process.cwd();
|
|
32
|
+
|
|
33
|
+
const typescriptParserOptions = {
|
|
34
|
+
projectService: true,
|
|
35
|
+
tsconfigRootDir,
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/** Cached flat config arrays (only two variants: default + strict). */
|
|
39
|
+
const configCache = new Map();
|
|
40
|
+
|
|
41
|
+
/** @param {Record<string, unknown>} tsRules - `typescriptRules` or `typescriptStrictRules` */
|
|
42
|
+
export function createBaseFlatConfigs(tsRules) {
|
|
43
|
+
if (configCache.has(tsRules)) {
|
|
44
|
+
return configCache.get(tsRules);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const config = defineConfig(
|
|
48
|
+
{ ignores: ignorePatterns },
|
|
49
|
+
eslint.configs.recommended,
|
|
50
|
+
eslintConfigPrettier,
|
|
51
|
+
{
|
|
52
|
+
plugins: {
|
|
53
|
+
'eslint-comments': eslintComments,
|
|
54
|
+
'import-x': importX,
|
|
55
|
+
},
|
|
56
|
+
languageOptions: {
|
|
57
|
+
ecmaVersion: 'latest',
|
|
58
|
+
sourceType: 'module',
|
|
59
|
+
parserOptions: {
|
|
60
|
+
ecmaFeatures: { jsx: true },
|
|
61
|
+
},
|
|
62
|
+
globals: {
|
|
63
|
+
...globals.browser,
|
|
64
|
+
...globals.node,
|
|
65
|
+
...globals.es2021,
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
settings: {
|
|
69
|
+
'import-x/resolver': {
|
|
70
|
+
node: { extensions: ['.js', '.jsx', '.ts', '.tsx'] },
|
|
71
|
+
typescript: { alwaysTryTypes: true },
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
rules: sharedCoreRules,
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
files: ['**/*.{js,jsx,mjs,cjs}'],
|
|
78
|
+
rules: jsRules,
|
|
79
|
+
},
|
|
80
|
+
...tseslint.configs.recommendedTypeChecked.map((config) => ({
|
|
81
|
+
...config,
|
|
82
|
+
files: ['**/*.{ts,tsx}'],
|
|
83
|
+
})),
|
|
84
|
+
{
|
|
85
|
+
files: ['**/*.{ts,tsx}'],
|
|
86
|
+
rules: tsRules,
|
|
87
|
+
languageOptions: {
|
|
88
|
+
parserOptions: typescriptParserOptions,
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
files: testFiles,
|
|
93
|
+
plugins: {
|
|
94
|
+
jest,
|
|
95
|
+
'testing-library': testingLibrary,
|
|
96
|
+
},
|
|
97
|
+
languageOptions: {
|
|
98
|
+
globals: globals.jest,
|
|
99
|
+
},
|
|
100
|
+
settings: {
|
|
101
|
+
jest: { version: 'detect' },
|
|
102
|
+
},
|
|
103
|
+
rules: {
|
|
104
|
+
...jestRecommendedRules,
|
|
105
|
+
...testingLibraryDomRules,
|
|
106
|
+
'testing-library/no-node-access': 'off',
|
|
107
|
+
...typescriptTestRelaxedRules,
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
files: testJsxFiles,
|
|
112
|
+
rules: {
|
|
113
|
+
...testingLibraryReactRules,
|
|
114
|
+
'testing-library/no-node-access': 'off',
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
files: wdioSpecFiles,
|
|
119
|
+
plugins: { wdio, jest },
|
|
120
|
+
languageOptions: { globals: wdioGlobals },
|
|
121
|
+
rules: {
|
|
122
|
+
...wdioRecommendedRules,
|
|
123
|
+
'jest/valid-expect': 'off',
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
files: ['**/eslint.config.{mjs,cjs,js}'],
|
|
128
|
+
rules: { 'import-x/no-unresolved': 'off' },
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
files: ['**/scripts/**', '**/ci_cd/**'],
|
|
132
|
+
rules: {
|
|
133
|
+
'no-console': 'off',
|
|
134
|
+
'max-lines': 'off',
|
|
135
|
+
complexity: 'off',
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
files: storybookFiles,
|
|
140
|
+
rules: { 'import-x/no-extraneous-dependencies': 'off' },
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
files: ['**/lint-config/**'],
|
|
144
|
+
rules: {
|
|
145
|
+
'max-lines': 'off',
|
|
146
|
+
'import-x/no-named-as-default-member': 'off',
|
|
147
|
+
'import-x/default': 'off',
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
files: ['**/*.d.ts'],
|
|
152
|
+
rules: {
|
|
153
|
+
'@typescript-eslint/no-explicit-any': 'off',
|
|
154
|
+
'@typescript-eslint/no-empty-object-type': 'off',
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
);
|
|
158
|
+
|
|
159
|
+
configCache.set(tsRules, config);
|
|
160
|
+
return config;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/** Default flat base — `no-unsafe-*` as warn in application TypeScript. */
|
|
164
|
+
export const baseFlatConfigs = createBaseFlatConfigs(typescriptRules);
|
|
165
|
+
|
|
166
|
+
/** Strict flat base — `no-unsafe-*` as error in application TypeScript. */
|
|
167
|
+
export const baseFlatConfigsStrict = createBaseFlatConfigs(typescriptStrictRules);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export { eslintFlatConfig, eslintFlatConfigStrict } from './react-export.mjs';
|
|
2
|
+
export {
|
|
3
|
+
eslintFlatBaseConfig,
|
|
4
|
+
eslintFlatBaseConfigStrict,
|
|
5
|
+
} from './non-react-export.mjs';
|
|
6
|
+
export { reactFlatConfigs, reactFlatConfigsStrict } from './react.mjs';
|
|
7
|
+
export {
|
|
8
|
+
nonReactFlatConfigs,
|
|
9
|
+
nonReactFlatConfigsStrict,
|
|
10
|
+
} from './non-react.mjs';
|
|
11
|
+
export {
|
|
12
|
+
baseFlatConfigs,
|
|
13
|
+
baseFlatConfigsStrict,
|
|
14
|
+
createBaseFlatConfigs,
|
|
15
|
+
} from './common.mjs';
|
|
16
|
+
export {
|
|
17
|
+
storybookFiles,
|
|
18
|
+
testFiles,
|
|
19
|
+
testJsxFiles,
|
|
20
|
+
} from './presets.mjs';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import {
|
|
2
|
+
nonReactFlatConfigs,
|
|
3
|
+
nonReactFlatConfigsStrict,
|
|
4
|
+
} from './non-react.mjs';
|
|
5
|
+
|
|
6
|
+
/** Flat ESLint config for non-React TypeScript libraries and services. */
|
|
7
|
+
export const eslintFlatBaseConfig = nonReactFlatConfigs;
|
|
8
|
+
|
|
9
|
+
/** Strict flat ESLint config for non-React TypeScript (`no-unsafe-*` as error). */
|
|
10
|
+
export const eslintFlatBaseConfigStrict = nonReactFlatConfigsStrict;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Preset rule bundles and file globs computed once at module load (not per config factory call).
|
|
3
|
+
*/
|
|
4
|
+
import eslintComments from 'eslint-plugin-eslint-comments';
|
|
5
|
+
import importX from 'eslint-plugin-import-x';
|
|
6
|
+
import jest from 'eslint-plugin-jest';
|
|
7
|
+
import jsxA11y from 'eslint-plugin-jsx-a11y';
|
|
8
|
+
import react from 'eslint-plugin-react';
|
|
9
|
+
import reactHooks from 'eslint-plugin-react-hooks';
|
|
10
|
+
import reduxSaga from 'eslint-plugin-redux-saga';
|
|
11
|
+
import storybook from 'eslint-plugin-storybook';
|
|
12
|
+
import testingLibrary from 'eslint-plugin-testing-library';
|
|
13
|
+
import wdio from 'eslint-plugin-wdio';
|
|
14
|
+
|
|
15
|
+
export const testFiles = [
|
|
16
|
+
'**/*.{test,spec}.{js,jsx,ts,tsx}',
|
|
17
|
+
'**/__tests__/**',
|
|
18
|
+
'**/lib/testing/**',
|
|
19
|
+
'**/mocks/**',
|
|
20
|
+
];
|
|
21
|
+
|
|
22
|
+
export const testJsxFiles = ['**/*.{test,spec}.{jsx,tsx}'];
|
|
23
|
+
|
|
24
|
+
export const wdioSpecFiles = [
|
|
25
|
+
'**/*.func.spec.js',
|
|
26
|
+
'**/*.visual.spec.js',
|
|
27
|
+
'**/*e2e*.{js,ts}',
|
|
28
|
+
];
|
|
29
|
+
|
|
30
|
+
export const storybookFiles = [
|
|
31
|
+
'**/*.stories.{js,jsx,ts,tsx}',
|
|
32
|
+
'**/.storybook/**',
|
|
33
|
+
];
|
|
34
|
+
|
|
35
|
+
/** @type {import('eslint').Linter.RulesRecord} */
|
|
36
|
+
export const sharedCoreRules = {
|
|
37
|
+
...eslintComments.configs.recommended.rules,
|
|
38
|
+
...importX.configs.recommended.rules,
|
|
39
|
+
'import-x/named': 'off',
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
/** @type {import('eslint').Linter.RulesRecord} */
|
|
43
|
+
export const jestRecommendedRules = jest.configs.recommended.rules;
|
|
44
|
+
|
|
45
|
+
const testingLibraryDom =
|
|
46
|
+
testingLibrary.configs['flat/dom'] ?? testingLibrary.configs.dom;
|
|
47
|
+
const testingLibraryReact =
|
|
48
|
+
testingLibrary.configs['flat/react'] ?? testingLibrary.configs.react;
|
|
49
|
+
|
|
50
|
+
/** @type {import('eslint').Linter.RulesRecord} */
|
|
51
|
+
export const testingLibraryDomRules = testingLibraryDom?.rules ?? {};
|
|
52
|
+
|
|
53
|
+
/** @type {import('eslint').Linter.RulesRecord} */
|
|
54
|
+
export const testingLibraryReactRules = testingLibraryReact?.rules ?? {};
|
|
55
|
+
|
|
56
|
+
/** @type {import('eslint').Linter.RulesRecord} */
|
|
57
|
+
export const reactPresetRules = {
|
|
58
|
+
...react.configs.recommended.rules,
|
|
59
|
+
...reactHooks.configs.recommended.rules,
|
|
60
|
+
...jsxA11y.flatConfigs.recommended.rules,
|
|
61
|
+
...reduxSaga.configs.recommended.rules,
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
/** @type {import('eslint').Linter.RulesRecord} */
|
|
65
|
+
export const wdioRecommendedRules = wdio.configs.recommended.rules ?? {};
|
|
66
|
+
|
|
67
|
+
/** @type {Record<string, boolean>} */
|
|
68
|
+
export const wdioGlobals = wdio.configs.recommended.globals ?? {};
|
|
69
|
+
|
|
70
|
+
const storybookFlat =
|
|
71
|
+
storybook.configs['flat/recommended'] ??
|
|
72
|
+
storybook.configs.recommended ??
|
|
73
|
+
[];
|
|
74
|
+
|
|
75
|
+
/** Normalized once — Storybook flat config may be array or single object. */
|
|
76
|
+
export const storybookFlatConfigs = Array.isArray(storybookFlat)
|
|
77
|
+
? storybookFlat
|
|
78
|
+
: [storybookFlat];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { reactFlatConfigs, reactFlatConfigsStrict } from './react.mjs';
|
|
2
|
+
|
|
3
|
+
/** Flat ESLint config for React + TypeScript PUI apps. */
|
|
4
|
+
export const eslintFlatConfig = reactFlatConfigs;
|
|
5
|
+
|
|
6
|
+
/** Strict flat ESLint config for React + TypeScript (errors on `no-unsafe-*` and `exhaustive-deps`). */
|
|
7
|
+
export const eslintFlatConfigStrict = reactFlatConfigsStrict;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { defineConfig } from 'eslint/config';
|
|
2
|
+
import jsxA11y from 'eslint-plugin-jsx-a11y';
|
|
3
|
+
import react from 'eslint-plugin-react';
|
|
4
|
+
import reactHooks from 'eslint-plugin-react-hooks';
|
|
5
|
+
import reduxSaga from 'eslint-plugin-redux-saga';
|
|
6
|
+
import { baseFlatConfigs, baseFlatConfigsStrict } from './common.mjs';
|
|
7
|
+
import {
|
|
8
|
+
reactPresetRules,
|
|
9
|
+
storybookFiles,
|
|
10
|
+
storybookFlatConfigs,
|
|
11
|
+
} from './presets.mjs';
|
|
12
|
+
import { reactRules, reactStrictRules } from './rules.mjs';
|
|
13
|
+
|
|
14
|
+
const reactPluginBlock = {
|
|
15
|
+
plugins: {
|
|
16
|
+
react,
|
|
17
|
+
'react-hooks': reactHooks,
|
|
18
|
+
'jsx-a11y': jsxA11y,
|
|
19
|
+
'redux-saga': reduxSaga,
|
|
20
|
+
},
|
|
21
|
+
settings: {
|
|
22
|
+
react: { version: 'detect' },
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @param {import('eslint').Linter.Config[]} baseConfigs
|
|
28
|
+
* @param {typeof reactRules} puiReactRules
|
|
29
|
+
*/
|
|
30
|
+
function createReactFlatConfigs(baseConfigs, puiReactRules) {
|
|
31
|
+
return defineConfig(
|
|
32
|
+
...baseConfigs,
|
|
33
|
+
{
|
|
34
|
+
...reactPluginBlock,
|
|
35
|
+
rules: {
|
|
36
|
+
...reactPresetRules,
|
|
37
|
+
...puiReactRules,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
...storybookFlatConfigs,
|
|
41
|
+
{
|
|
42
|
+
files: storybookFiles,
|
|
43
|
+
rules: {
|
|
44
|
+
'react/jsx-props-no-spreading': 'off',
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** Default React flat config — migration-friendly type-safety warnings. */
|
|
51
|
+
export const reactFlatConfigs = createReactFlatConfigs(
|
|
52
|
+
baseFlatConfigs,
|
|
53
|
+
reactRules,
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
/** Strict React flat config — `no-unsafe-*` and `exhaustive-deps` as error. */
|
|
57
|
+
export const reactFlatConfigsStrict = createReactFlatConfigs(
|
|
58
|
+
baseFlatConfigsStrict,
|
|
59
|
+
reactStrictRules,
|
|
60
|
+
);
|