@elliemae/pui-cli 9.0.0-alpha.1 → 9.0.0-alpha.3
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 +162 -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 +79 -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 +170 -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 +4 -4
- 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 +162 -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 +79 -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 +170 -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 +4 -4
- 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/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 +350 -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 +162 -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 +79 -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 +170 -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 +21 -22
|
@@ -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,162 @@
|
|
|
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
|
+
testFiles,
|
|
15
|
+
testJsxFiles,
|
|
16
|
+
testingLibraryDomRules,
|
|
17
|
+
testingLibraryReactRules,
|
|
18
|
+
wdioGlobals,
|
|
19
|
+
wdioRecommendedRules,
|
|
20
|
+
wdioSpecFiles,
|
|
21
|
+
} from './presets.mjs';
|
|
22
|
+
import {
|
|
23
|
+
ignorePatterns,
|
|
24
|
+
jsRules,
|
|
25
|
+
typescriptRules,
|
|
26
|
+
typescriptStrictRules,
|
|
27
|
+
typescriptTestRelaxedRules,
|
|
28
|
+
} from './rules.mjs';
|
|
29
|
+
|
|
30
|
+
const tsconfigRootDir = process.cwd();
|
|
31
|
+
|
|
32
|
+
const typescriptParserOptions = {
|
|
33
|
+
projectService: true,
|
|
34
|
+
tsconfigRootDir,
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/** Cached flat config arrays (only two variants: default + strict). */
|
|
38
|
+
const configCache = new Map();
|
|
39
|
+
|
|
40
|
+
/** @param {Record<string, unknown>} tsRules - `typescriptRules` or `typescriptStrictRules` */
|
|
41
|
+
export function createBaseFlatConfigs(tsRules) {
|
|
42
|
+
if (configCache.has(tsRules)) {
|
|
43
|
+
return configCache.get(tsRules);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const config = defineConfig(
|
|
47
|
+
{ ignores: ignorePatterns },
|
|
48
|
+
eslint.configs.recommended,
|
|
49
|
+
eslintConfigPrettier,
|
|
50
|
+
{
|
|
51
|
+
plugins: {
|
|
52
|
+
'eslint-comments': eslintComments,
|
|
53
|
+
'import-x': importX,
|
|
54
|
+
},
|
|
55
|
+
languageOptions: {
|
|
56
|
+
ecmaVersion: 'latest',
|
|
57
|
+
sourceType: 'module',
|
|
58
|
+
parserOptions: {
|
|
59
|
+
ecmaFeatures: { jsx: true },
|
|
60
|
+
},
|
|
61
|
+
globals: {
|
|
62
|
+
...globals.browser,
|
|
63
|
+
...globals.node,
|
|
64
|
+
...globals.es2021,
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
settings: {
|
|
68
|
+
'import-x/resolver': {
|
|
69
|
+
node: { extensions: ['.js', '.jsx', '.ts', '.tsx'] },
|
|
70
|
+
typescript: { alwaysTryTypes: true },
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
rules: sharedCoreRules,
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
files: ['**/*.{js,jsx,mjs,cjs}'],
|
|
77
|
+
rules: jsRules,
|
|
78
|
+
},
|
|
79
|
+
...tseslint.configs.recommendedTypeChecked.map((config) => ({
|
|
80
|
+
...config,
|
|
81
|
+
files: ['**/*.{ts,tsx}'],
|
|
82
|
+
})),
|
|
83
|
+
{
|
|
84
|
+
files: ['**/*.{ts,tsx}'],
|
|
85
|
+
rules: tsRules,
|
|
86
|
+
languageOptions: {
|
|
87
|
+
parserOptions: typescriptParserOptions,
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
files: testFiles,
|
|
92
|
+
plugins: {
|
|
93
|
+
jest,
|
|
94
|
+
'testing-library': testingLibrary,
|
|
95
|
+
},
|
|
96
|
+
languageOptions: {
|
|
97
|
+
globals: globals.jest,
|
|
98
|
+
},
|
|
99
|
+
settings: {
|
|
100
|
+
jest: { version: 'detect' },
|
|
101
|
+
},
|
|
102
|
+
rules: {
|
|
103
|
+
...jestRecommendedRules,
|
|
104
|
+
...testingLibraryDomRules,
|
|
105
|
+
'testing-library/no-node-access': 'off',
|
|
106
|
+
...typescriptTestRelaxedRules,
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
files: testJsxFiles,
|
|
111
|
+
rules: {
|
|
112
|
+
...testingLibraryReactRules,
|
|
113
|
+
'testing-library/no-node-access': 'off',
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
files: wdioSpecFiles,
|
|
118
|
+
plugins: { wdio, jest },
|
|
119
|
+
languageOptions: { globals: wdioGlobals },
|
|
120
|
+
rules: {
|
|
121
|
+
...wdioRecommendedRules,
|
|
122
|
+
'jest/valid-expect': 'off',
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
files: ['**/eslint.config.{mjs,cjs,js}'],
|
|
127
|
+
rules: { 'import-x/no-unresolved': 'off' },
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
files: ['**/scripts/**', '**/ci_cd/**'],
|
|
131
|
+
rules: {
|
|
132
|
+
'no-console': 'off',
|
|
133
|
+
'max-lines': 'off',
|
|
134
|
+
complexity: 'off',
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
files: ['**/lint-config/**'],
|
|
139
|
+
rules: {
|
|
140
|
+
'max-lines': 'off',
|
|
141
|
+
'import-x/no-named-as-default-member': 'off',
|
|
142
|
+
'import-x/default': 'off',
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
files: ['**/*.d.ts'],
|
|
147
|
+
rules: {
|
|
148
|
+
'@typescript-eslint/no-explicit-any': 'off',
|
|
149
|
+
'@typescript-eslint/no-empty-object-type': 'off',
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
);
|
|
153
|
+
|
|
154
|
+
configCache.set(tsRules, config);
|
|
155
|
+
return config;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/** Default flat base — `no-unsafe-*` as warn in application TypeScript. */
|
|
159
|
+
export const baseFlatConfigs = createBaseFlatConfigs(typescriptRules);
|
|
160
|
+
|
|
161
|
+
/** Strict flat base — `no-unsafe-*` as error in application TypeScript. */
|
|
162
|
+
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,79 @@
|
|
|
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
|
+
'**/e2e/**',
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
export const storybookFiles = [
|
|
32
|
+
'**/*.stories.{js,jsx,ts,tsx}',
|
|
33
|
+
'**/.storybook/**',
|
|
34
|
+
];
|
|
35
|
+
|
|
36
|
+
/** @type {import('eslint').Linter.RulesRecord} */
|
|
37
|
+
export const sharedCoreRules = {
|
|
38
|
+
...eslintComments.configs.recommended.rules,
|
|
39
|
+
...importX.configs.recommended.rules,
|
|
40
|
+
'import-x/named': 'off',
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/** @type {import('eslint').Linter.RulesRecord} */
|
|
44
|
+
export const jestRecommendedRules = jest.configs.recommended.rules;
|
|
45
|
+
|
|
46
|
+
const testingLibraryDom =
|
|
47
|
+
testingLibrary.configs['flat/dom'] ?? testingLibrary.configs.dom;
|
|
48
|
+
const testingLibraryReact =
|
|
49
|
+
testingLibrary.configs['flat/react'] ?? testingLibrary.configs.react;
|
|
50
|
+
|
|
51
|
+
/** @type {import('eslint').Linter.RulesRecord} */
|
|
52
|
+
export const testingLibraryDomRules = testingLibraryDom?.rules ?? {};
|
|
53
|
+
|
|
54
|
+
/** @type {import('eslint').Linter.RulesRecord} */
|
|
55
|
+
export const testingLibraryReactRules = testingLibraryReact?.rules ?? {};
|
|
56
|
+
|
|
57
|
+
/** @type {import('eslint').Linter.RulesRecord} */
|
|
58
|
+
export const reactPresetRules = {
|
|
59
|
+
...react.configs.recommended.rules,
|
|
60
|
+
...reactHooks.configs.recommended.rules,
|
|
61
|
+
...jsxA11y.flatConfigs.recommended.rules,
|
|
62
|
+
...reduxSaga.configs.recommended.rules,
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
/** @type {import('eslint').Linter.RulesRecord} */
|
|
66
|
+
export const wdioRecommendedRules = wdio.configs.recommended.rules ?? {};
|
|
67
|
+
|
|
68
|
+
/** @type {Record<string, boolean>} */
|
|
69
|
+
export const wdioGlobals = wdio.configs.recommended.globals ?? {};
|
|
70
|
+
|
|
71
|
+
const storybookFlat =
|
|
72
|
+
storybook.configs['flat/recommended'] ??
|
|
73
|
+
storybook.configs.recommended ??
|
|
74
|
+
[];
|
|
75
|
+
|
|
76
|
+
/** Normalized once — Storybook flat config may be array or single object. */
|
|
77
|
+
export const storybookFlatConfigs = Array.isArray(storybookFlat)
|
|
78
|
+
? storybookFlat
|
|
79
|
+
: [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
|
+
);
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/** Shared rule sets migrated from legacy eslintrc (common.cjs + typescript/*.cjs). */
|
|
2
|
+
|
|
3
|
+
export const baseRules = {
|
|
4
|
+
'arrow-body-style': ['error', 'as-needed'],
|
|
5
|
+
'class-methods-use-this': 'off',
|
|
6
|
+
'import-x/imports-first': 'off',
|
|
7
|
+
'import-x/newline-after-import': 'off',
|
|
8
|
+
'import-x/no-dynamic-require': 'off',
|
|
9
|
+
// Off — legacy parity; PUI apps import via @elliemae/app-react-dependencies (not direct package.json entries).
|
|
10
|
+
'import-x/no-extraneous-dependencies': 'off',
|
|
11
|
+
'import-x/no-named-as-default': 'off',
|
|
12
|
+
'import-x/no-unresolved': [
|
|
13
|
+
'error',
|
|
14
|
+
{ caseSensitive: true, caseSensitiveStrict: true },
|
|
15
|
+
],
|
|
16
|
+
'import-x/no-webpack-loader-syntax': 'off',
|
|
17
|
+
'import-x/prefer-default-export': 'off',
|
|
18
|
+
'import-x/default': 'off',
|
|
19
|
+
'import-x/namespace': 'off',
|
|
20
|
+
'import-x/extensions': [
|
|
21
|
+
'error',
|
|
22
|
+
'never',
|
|
23
|
+
{
|
|
24
|
+
json: 'ignorePackages',
|
|
25
|
+
js: 'ignorePackages',
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
complexity: ['error', { max: 10 }],
|
|
29
|
+
'max-depth': ['error', { max: 4 }],
|
|
30
|
+
'max-lines-per-function': 'off',
|
|
31
|
+
'max-nested-callbacks': ['error', { max: 3 }],
|
|
32
|
+
'max-params': ['error', { max: 3 }],
|
|
33
|
+
'max-statements': ['error', { max: 20 }],
|
|
34
|
+
'max-len': 'off',
|
|
35
|
+
'newline-per-chained-call': 'off',
|
|
36
|
+
'no-confusing-arrow': 'off',
|
|
37
|
+
'no-console': 'warn',
|
|
38
|
+
'no-param-reassign': ['error', { props: false }],
|
|
39
|
+
'prefer-template': 'error',
|
|
40
|
+
'require-yield': 'off',
|
|
41
|
+
'eslint-comments/disable-enable-pair': 'off',
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/** Relaxed type-checked rules for test files (shared by default and strict configs). */
|
|
45
|
+
export const typescriptTestRelaxedRules = {
|
|
46
|
+
'@typescript-eslint/no-unsafe-assignment': 'off',
|
|
47
|
+
'@typescript-eslint/no-unsafe-member-access': 'off',
|
|
48
|
+
'@typescript-eslint/no-unsafe-call': 'off',
|
|
49
|
+
'@typescript-eslint/no-unsafe-argument': 'off',
|
|
50
|
+
'@typescript-eslint/no-unsafe-return': 'off',
|
|
51
|
+
'@typescript-eslint/unbound-method': 'off',
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export const jsRules = {
|
|
55
|
+
...baseRules,
|
|
56
|
+
'max-lines': ['error', { max: 120, skipComments: true }],
|
|
57
|
+
'no-unused-vars': 'error',
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export const typescriptRules = {
|
|
61
|
+
...baseRules,
|
|
62
|
+
'max-lines': ['error', { max: 200, skipComments: true }],
|
|
63
|
+
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
64
|
+
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
65
|
+
'@typescript-eslint/no-use-before-define': [
|
|
66
|
+
'error',
|
|
67
|
+
{ functions: false, classes: true, variables: true, typedefs: true },
|
|
68
|
+
],
|
|
69
|
+
'@typescript-eslint/unbound-method': ['error', { ignoreStatic: true }],
|
|
70
|
+
'@typescript-eslint/no-floating-promises': ['error', { ignoreIIFE: true }],
|
|
71
|
+
'@typescript-eslint/no-misused-promises': [
|
|
72
|
+
'error',
|
|
73
|
+
{ checksVoidReturn: { attributes: false } },
|
|
74
|
+
],
|
|
75
|
+
'@typescript-eslint/no-unsafe-assignment': 'warn',
|
|
76
|
+
'@typescript-eslint/no-unsafe-member-access': 'warn',
|
|
77
|
+
'@typescript-eslint/no-unsafe-call': 'warn',
|
|
78
|
+
'@typescript-eslint/no-unsafe-argument': 'warn',
|
|
79
|
+
'@typescript-eslint/no-unsafe-return': 'warn',
|
|
80
|
+
'@typescript-eslint/consistent-type-imports': [
|
|
81
|
+
'error',
|
|
82
|
+
{ prefer: 'type-imports', fixStyle: 'inline-type-imports' },
|
|
83
|
+
],
|
|
84
|
+
'@typescript-eslint/no-import-type-side-effects': 'error',
|
|
85
|
+
'no-unused-vars': 'off',
|
|
86
|
+
'@typescript-eslint/no-unused-vars': [
|
|
87
|
+
'error',
|
|
88
|
+
{ argsIgnorePattern: '^_', ignoreRestSiblings: true },
|
|
89
|
+
],
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
/** Stricter TypeScript rules (error on unsafe any usage). */
|
|
93
|
+
export const typescriptStrictRules = {
|
|
94
|
+
...typescriptRules,
|
|
95
|
+
'@typescript-eslint/no-unsafe-assignment': 'error',
|
|
96
|
+
'@typescript-eslint/no-unsafe-member-access': 'error',
|
|
97
|
+
'@typescript-eslint/no-unsafe-call': 'error',
|
|
98
|
+
'@typescript-eslint/no-unsafe-argument': 'error',
|
|
99
|
+
'@typescript-eslint/no-unsafe-return': 'error',
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export const reactRules = {
|
|
103
|
+
'jsx-a11y/aria-props': 'error',
|
|
104
|
+
'jsx-a11y/heading-has-content': 'off',
|
|
105
|
+
'jsx-a11y/label-has-associated-control': [
|
|
106
|
+
'error',
|
|
107
|
+
{
|
|
108
|
+
controlComponents: ['Input'],
|
|
109
|
+
},
|
|
110
|
+
],
|
|
111
|
+
'jsx-a11y/label-has-for': 'off',
|
|
112
|
+
'jsx-a11y/mouse-events-have-key-events': 'error',
|
|
113
|
+
'jsx-a11y/role-has-required-aria-props': 'error',
|
|
114
|
+
'jsx-a11y/role-supports-aria-props': 'error',
|
|
115
|
+
'react/destructuring-assignment': 'off',
|
|
116
|
+
'react-hooks/rules-of-hooks': 'error',
|
|
117
|
+
'react-hooks/exhaustive-deps': 'warn',
|
|
118
|
+
'react/jsx-closing-tag-location': 'off',
|
|
119
|
+
'react/forbid-prop-types': 'off',
|
|
120
|
+
'react/jsx-first-prop-new-line': ['error', 'multiline'],
|
|
121
|
+
'react/jsx-no-target-blank': 'off',
|
|
122
|
+
'react/jsx-props-no-spreading': 'off',
|
|
123
|
+
'react/jsx-uses-vars': 'error',
|
|
124
|
+
'react/require-default-props': 'off',
|
|
125
|
+
'react/require-extension': 'off',
|
|
126
|
+
'react/self-closing-comp': 'off',
|
|
127
|
+
'react/sort-comp': 'off',
|
|
128
|
+
'react/react-in-jsx-scope': 'off',
|
|
129
|
+
'react/jsx-filename-extension': [
|
|
130
|
+
'warn',
|
|
131
|
+
{ extensions: ['.js', '.jsx', '.tsx', '.mdx'] },
|
|
132
|
+
],
|
|
133
|
+
'react/function-component-definition': [
|
|
134
|
+
'error',
|
|
135
|
+
{ namedComponents: 'arrow-function' },
|
|
136
|
+
],
|
|
137
|
+
'react/prop-types': 'off',
|
|
138
|
+
'redux-saga/no-yield-in-race': 'error',
|
|
139
|
+
'redux-saga/yield-effects': 'error',
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
/** Stricter React rules (exhaustive-deps as error). */
|
|
143
|
+
export const reactStrictRules = {
|
|
144
|
+
...reactRules,
|
|
145
|
+
'react-hooks/exhaustive-deps': 'error',
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
export const ignorePatterns = [
|
|
149
|
+
'**/build/**',
|
|
150
|
+
'**/node_modules/**',
|
|
151
|
+
'**/dist/**',
|
|
152
|
+
'**/reports/**',
|
|
153
|
+
'**/allure-report/**',
|
|
154
|
+
'**/coverage/**',
|
|
155
|
+
'**/demo/**',
|
|
156
|
+
'**/docs/**',
|
|
157
|
+
'**/docs/api/**',
|
|
158
|
+
'**/temp/**',
|
|
159
|
+
'**/.tmp/**',
|
|
160
|
+
'**/public/**',
|
|
161
|
+
'**/webroot/**',
|
|
162
|
+
'**/cdn/**',
|
|
163
|
+
'**/.docusaurus/**',
|
|
164
|
+
'**/vendor/*.js',
|
|
165
|
+
'**/.nx/**',
|
|
166
|
+
'**/pnpm-lock.yaml',
|
|
167
|
+
'**/.scannerwork/**',
|
|
168
|
+
'**/stats.json',
|
|
169
|
+
'**/jsconfig.json',
|
|
170
|
+
];
|