@elliemae/pui-cli 7.0.0-alpha.2 → 7.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/dist/cjs/babel/babel.config.cjs +101 -0
- package/dist/cjs/lint/commitlint.config.cjs +1 -0
- package/dist/cjs/lint/eslint/common.cjs +160 -0
- package/dist/cjs/lint/eslint/non-react.cjs +14 -0
- package/dist/cjs/lint/eslint/react.cjs +26 -0
- package/dist/cjs/lint/eslint/typescript/common.cjs +43 -0
- package/dist/cjs/lint/eslint/typescript/non-react.cjs +12 -0
- package/dist/cjs/lint/eslint/typescript/react.cjs +19 -0
- package/dist/cjs/lint/prettier.config.cjs +8 -0
- package/dist/cjs/lint/stylelint.config.cjs +19 -0
- package/dist/cjs/release/release.config.cjs +31 -0
- package/dist/cjs/testing/jest.config.cjs +106 -0
- package/dist/cjs/testing/jest.node.config.cjs +8 -0
- package/dist/cjs/testing/mocks/axios.cjs +15 -0
- package/dist/cjs/testing/mocks/cssModule.cjs +1 -0
- package/dist/cjs/testing/mocks/html.cjs +1 -0
- package/dist/cjs/testing/mocks/image.cjs +1 -0
- package/dist/cjs/testing/mocks/matchMedia.cjs +24 -0
- package/dist/cjs/testing/mocks/pui-app-loader.cjs +1 -0
- package/dist/cjs/testing/mocks/pui-diagnostics.cjs +28 -0
- package/dist/cjs/testing/mocks/pui-user-monitoring.cjs +3 -0
- package/dist/cjs/testing/mocks/retry-axios.cjs +3 -0
- package/dist/cjs/testing/mocks/svg.cjs +5 -0
- package/dist/cjs/testing/mocks/webpack-hmr.cjs +1 -0
- package/dist/cjs/testing/resolver.cjs +47 -0
- package/dist/cjs/transpile/esbuild.js +1 -1
- package/dist/cjs/transpile/swcrc.config.cjs +13 -0
- package/dist/cjs/utils.cjs +20 -0
- package/dist/cjs/webpack/webpack.storybook.cjs +87 -0
- package/dist/esm/babel/babel.config.cjs +101 -0
- package/dist/esm/lint/commitlint.config.cjs +1 -0
- package/dist/esm/lint/eslint/common.cjs +160 -0
- package/dist/esm/lint/eslint/non-react.cjs +14 -0
- package/dist/esm/lint/eslint/react.cjs +26 -0
- package/dist/esm/lint/eslint/typescript/common.cjs +43 -0
- package/dist/esm/lint/eslint/typescript/non-react.cjs +12 -0
- package/dist/esm/lint/eslint/typescript/react.cjs +19 -0
- package/dist/esm/lint/prettier.config.cjs +8 -0
- package/dist/esm/lint/stylelint.config.cjs +19 -0
- package/dist/esm/release/release.config.cjs +31 -0
- package/dist/esm/testing/jest.config.cjs +106 -0
- package/dist/esm/testing/jest.node.config.cjs +8 -0
- package/dist/esm/testing/mocks/axios.cjs +15 -0
- package/dist/esm/testing/mocks/cssModule.cjs +1 -0
- package/dist/esm/testing/mocks/html.cjs +1 -0
- package/dist/esm/testing/mocks/image.cjs +1 -0
- package/dist/esm/testing/mocks/matchMedia.cjs +24 -0
- package/dist/esm/testing/mocks/pui-app-loader.cjs +1 -0
- package/dist/esm/testing/mocks/pui-diagnostics.cjs +28 -0
- package/dist/esm/testing/mocks/pui-user-monitoring.cjs +3 -0
- package/dist/esm/testing/mocks/retry-axios.cjs +3 -0
- package/dist/esm/testing/mocks/svg.cjs +5 -0
- package/dist/esm/testing/mocks/webpack-hmr.cjs +1 -0
- package/dist/esm/testing/resolver.cjs +47 -0
- package/dist/esm/transpile/esbuild.js +1 -1
- package/dist/esm/transpile/swcrc.config.cjs +13 -0
- package/dist/esm/utils.cjs +20 -0
- package/dist/esm/webpack/webpack.storybook.cjs +87 -0
- package/package.json +1 -1
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
const { isApp } = require('../utils.cjs');
|
|
2
|
+
|
|
3
|
+
const nodeEnvPreset = {
|
|
4
|
+
modules: process.env.ES_MODULES === 'false' ? 'commonjs' : false,
|
|
5
|
+
targets: {
|
|
6
|
+
node: 'current',
|
|
7
|
+
},
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const webEnvPreset = {
|
|
11
|
+
modules: process.env.ES_MODULES === 'false' ? 'commonjs' : false,
|
|
12
|
+
useBuiltIns: 'usage',
|
|
13
|
+
corejs: { version: '3.19', proposals: true },
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const presetEnvOptions =
|
|
17
|
+
process.env.TARGET_ENV === 'node' ? nodeEnvPreset : webEnvPreset;
|
|
18
|
+
|
|
19
|
+
const config = {
|
|
20
|
+
ignore: [/\/core-js/],
|
|
21
|
+
sourceType: 'unambiguous',
|
|
22
|
+
presets: [
|
|
23
|
+
['@babel/preset-env', presetEnvOptions],
|
|
24
|
+
['@babel/preset-react', { runtime: 'automatic' }],
|
|
25
|
+
'@babel/preset-typescript',
|
|
26
|
+
],
|
|
27
|
+
plugins: [
|
|
28
|
+
[
|
|
29
|
+
'babel-plugin-module-resolver',
|
|
30
|
+
{
|
|
31
|
+
alias: {
|
|
32
|
+
'@': isApp() ? './app' : './lib',
|
|
33
|
+
},
|
|
34
|
+
stripExtensions: [],
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
['babel-plugin-styled-components', { displayName: true }],
|
|
38
|
+
['@babel/plugin-transform-runtime', { regenerator: true }],
|
|
39
|
+
'@babel/plugin-proposal-class-properties',
|
|
40
|
+
'@babel/plugin-syntax-dynamic-import',
|
|
41
|
+
'@babel/plugin-proposal-export-default-from',
|
|
42
|
+
'lodash',
|
|
43
|
+
'date-fns',
|
|
44
|
+
],
|
|
45
|
+
env: {
|
|
46
|
+
development: {
|
|
47
|
+
plugins: [
|
|
48
|
+
['babel-plugin-styled-components', { displayName: true }],
|
|
49
|
+
'@babel/plugin-transform-react-jsx-source',
|
|
50
|
+
],
|
|
51
|
+
},
|
|
52
|
+
production: {
|
|
53
|
+
plugins: [
|
|
54
|
+
['babel-plugin-styled-components', { displayName: false, pure: true }],
|
|
55
|
+
['transform-remove-console', { exclude: ['error', 'warn'] }],
|
|
56
|
+
'transform-react-remove-prop-types',
|
|
57
|
+
'@babel/plugin-transform-react-inline-elements',
|
|
58
|
+
'@babel/plugin-transform-react-constant-elements',
|
|
59
|
+
],
|
|
60
|
+
},
|
|
61
|
+
test: {
|
|
62
|
+
plugins: [
|
|
63
|
+
['babel-plugin-styled-components', { displayName: true }],
|
|
64
|
+
'@babel/plugin-transform-modules-commonjs',
|
|
65
|
+
'dynamic-import-node',
|
|
66
|
+
[
|
|
67
|
+
'babel-plugin-transform-strip-block',
|
|
68
|
+
{
|
|
69
|
+
requireDirective: true,
|
|
70
|
+
identifiers: [{ start: 'block:start', end: 'block:end' }],
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
'babel-plugin-import-remove-resource-query',
|
|
74
|
+
],
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
if (process.env.MODULE_EXTENSIONS === 'true') {
|
|
80
|
+
config.plugins.push('babel-plugin-add-import-extension');
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (
|
|
84
|
+
process.env.STORYBOOK_BUILD !== 'true' &&
|
|
85
|
+
process.env.TARGET_ENV !== 'node'
|
|
86
|
+
) {
|
|
87
|
+
config.env?.development?.plugins?.push?.('react-refresh/babel');
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// ToDo: Once ECC team migrates from webpack 3 to webpack 5 remove this strip-block plugin from commonjs output. without this they are receiving error when import.meta is used in app sdk
|
|
91
|
+
if (process.env.ES_MODULES === 'false') {
|
|
92
|
+
config.plugins.push([
|
|
93
|
+
'babel-plugin-transform-strip-block',
|
|
94
|
+
{
|
|
95
|
+
requireDirective: true,
|
|
96
|
+
identifiers: [{ start: 'block:start', end: 'block:end' }],
|
|
97
|
+
},
|
|
98
|
+
]);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
exports.babelConfig = config;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
exports.commitlintConfig = { extends: ['@commitlint/config-conventional'] };
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/* eslint-disable max-lines */
|
|
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
|
+
},
|
|
137
|
+
settings: {
|
|
138
|
+
react: {
|
|
139
|
+
version: 'detect',
|
|
140
|
+
},
|
|
141
|
+
jest: {
|
|
142
|
+
version: 28,
|
|
143
|
+
},
|
|
144
|
+
// 'import/resolver': {
|
|
145
|
+
// webpack: {
|
|
146
|
+
// config: webpackConfig,
|
|
147
|
+
// },
|
|
148
|
+
// },
|
|
149
|
+
},
|
|
150
|
+
ignorePatterns: [
|
|
151
|
+
'/build/**/*',
|
|
152
|
+
'/dist/**/*',
|
|
153
|
+
'/reports/**/*',
|
|
154
|
+
'/coverage/**/*',
|
|
155
|
+
'/demo/**/*',
|
|
156
|
+
'/docs/**/*',
|
|
157
|
+
'/temp/**/*',
|
|
158
|
+
'**/vendor/*.js',
|
|
159
|
+
],
|
|
160
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const {
|
|
2
|
+
baseExtends,
|
|
3
|
+
baseRules,
|
|
4
|
+
baseOverrides,
|
|
5
|
+
baseConfig,
|
|
6
|
+
} = require('./common.cjs');
|
|
7
|
+
const { tsConfig } = require('./typescript/non-react.cjs');
|
|
8
|
+
|
|
9
|
+
exports.esConfig = {
|
|
10
|
+
...baseConfig,
|
|
11
|
+
extends: ['airbnb-base'].concat(baseExtends),
|
|
12
|
+
rules: baseRules,
|
|
13
|
+
overrides: baseOverrides.concat([tsConfig]),
|
|
14
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
const {
|
|
2
|
+
baseExtends,
|
|
3
|
+
baseRules,
|
|
4
|
+
baseOverrides,
|
|
5
|
+
baseConfig,
|
|
6
|
+
reactRules,
|
|
7
|
+
} = require('./common.cjs');
|
|
8
|
+
const { tsReactConfig } = require('./typescript/react.cjs');
|
|
9
|
+
|
|
10
|
+
exports.esReactConfig = {
|
|
11
|
+
...baseConfig,
|
|
12
|
+
extends: ['airbnb', 'airbnb/hooks', 'plugin:redux-saga/recommended'].concat(
|
|
13
|
+
baseExtends,
|
|
14
|
+
),
|
|
15
|
+
rules: {
|
|
16
|
+
...baseRules,
|
|
17
|
+
...reactRules,
|
|
18
|
+
},
|
|
19
|
+
overrides: baseOverrides.concat([
|
|
20
|
+
tsReactConfig,
|
|
21
|
+
{
|
|
22
|
+
files: '*.mdx',
|
|
23
|
+
extends: 'plugin:mdx/recommended',
|
|
24
|
+
},
|
|
25
|
+
]),
|
|
26
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
const { baseExtends, basePlugins } = require('../common.cjs');
|
|
2
|
+
|
|
3
|
+
exports.tsBaseExtends = [
|
|
4
|
+
'plugin:@typescript-eslint/recommended',
|
|
5
|
+
'plugin:import/typescript',
|
|
6
|
+
'plugin:@typescript-eslint/recommended-requiring-type-checking',
|
|
7
|
+
].concat(baseExtends);
|
|
8
|
+
|
|
9
|
+
exports.tsBaseRules = {
|
|
10
|
+
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
11
|
+
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
12
|
+
'@typescript-eslint/no-use-before-define': [
|
|
13
|
+
'error',
|
|
14
|
+
{ functions: false, classes: true, variables: true, typedefs: true },
|
|
15
|
+
],
|
|
16
|
+
'max-lines': ['error', { max: 200, skipComments: true }],
|
|
17
|
+
'@typescript-eslint/unbound-method': [
|
|
18
|
+
'error',
|
|
19
|
+
{
|
|
20
|
+
ignoreStatic: true,
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
exports.tsBaseConfig = {
|
|
26
|
+
files: ['*.ts', '*.tsx'],
|
|
27
|
+
parser: '@typescript-eslint/parser',
|
|
28
|
+
plugins: ['@typescript-eslint'].concat(basePlugins),
|
|
29
|
+
parserOptions: {
|
|
30
|
+
tsconfigRootDir: process.cwd(),
|
|
31
|
+
project: 'tsconfig.json',
|
|
32
|
+
},
|
|
33
|
+
settings: {
|
|
34
|
+
'import/resolver': {
|
|
35
|
+
typescript: {
|
|
36
|
+
alwaysTryTypes: true,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
'import/parsers': {
|
|
40
|
+
'@typescript-eslint/parser': ['.ts', '.tsx'],
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/* eslint-disable max-lines */
|
|
2
|
+
const { baseRules } = require('../common.cjs');
|
|
3
|
+
const { tsBaseExtends, tsBaseRules, tsBaseConfig } = require('./common.cjs');
|
|
4
|
+
|
|
5
|
+
exports.tsConfig = {
|
|
6
|
+
...tsBaseConfig,
|
|
7
|
+
extends: ['airbnb-base', 'airbnb-typescript/base'].concat(tsBaseExtends),
|
|
8
|
+
rules: {
|
|
9
|
+
...baseRules,
|
|
10
|
+
...tsBaseRules,
|
|
11
|
+
},
|
|
12
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/* eslint-disable max-lines */
|
|
2
|
+
const { baseRules, reactRules } = require('../common.cjs');
|
|
3
|
+
const { tsBaseExtends, tsBaseRules, tsBaseConfig } = require('./common.cjs');
|
|
4
|
+
|
|
5
|
+
exports.tsReactConfig = {
|
|
6
|
+
...tsBaseConfig,
|
|
7
|
+
extends: [
|
|
8
|
+
'airbnb',
|
|
9
|
+
'airbnb/hooks',
|
|
10
|
+
'plugin:redux-saga/recommended',
|
|
11
|
+
'airbnb-typescript',
|
|
12
|
+
].concat(tsBaseExtends),
|
|
13
|
+
rules: {
|
|
14
|
+
...baseRules,
|
|
15
|
+
...tsBaseRules,
|
|
16
|
+
...reactRules,
|
|
17
|
+
'react/prop-types': 0,
|
|
18
|
+
},
|
|
19
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
exports.stylelintConfig = {
|
|
2
|
+
ignoreFiles: [
|
|
3
|
+
'/dist/**/*',
|
|
4
|
+
'/coverage/**/*',
|
|
5
|
+
'/build/**/*',
|
|
6
|
+
'/reports/**/*',
|
|
7
|
+
'/temp/**/*',
|
|
8
|
+
'/docs/**/*',
|
|
9
|
+
'/demo/**/*',
|
|
10
|
+
'/node_modules/**/*',
|
|
11
|
+
'/vendor/**/*',
|
|
12
|
+
],
|
|
13
|
+
customSyntax: '@stylelint/postcss-css-in-js',
|
|
14
|
+
extends: [
|
|
15
|
+
'stylelint-config-recommended',
|
|
16
|
+
'stylelint-config-styled-components',
|
|
17
|
+
],
|
|
18
|
+
rules: { 'selector-type-no-unknown': null, 'no-extra-semicolons': null },
|
|
19
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
branches: [
|
|
3
|
+
'+([0-9])?(.{+([0-9]),x}).x',
|
|
4
|
+
'master',
|
|
5
|
+
'next-major',
|
|
6
|
+
{ name: 'beta', prerelease: true },
|
|
7
|
+
{ name: 'alpha', prerelease: true },
|
|
8
|
+
{ name: 'hotfix', prerelease: true },
|
|
9
|
+
{ name: 'next', prerelease: true },
|
|
10
|
+
],
|
|
11
|
+
plugins: [
|
|
12
|
+
'@semantic-release/commit-analyzer',
|
|
13
|
+
'@semantic-release/release-notes-generator',
|
|
14
|
+
[
|
|
15
|
+
'@semantic-release/changelog',
|
|
16
|
+
{
|
|
17
|
+
changelogTitle:
|
|
18
|
+
'# Changelog\n\nAll notable changes to this project will be documented in this file. See\n[Conventional Commits](https://conventionalcommits.org) for commit guidelines.',
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
'@semantic-release/npm',
|
|
22
|
+
'@semantic-release/github',
|
|
23
|
+
[
|
|
24
|
+
'@semantic-release/exec',
|
|
25
|
+
{
|
|
26
|
+
successCmd:
|
|
27
|
+
'scmutil get slack-release-notes && scmutil get contributors',
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
],
|
|
31
|
+
};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const normalizePath = require('normalize-path');
|
|
3
|
+
const { getAppConfig, basePath } = require('../utils.cjs');
|
|
4
|
+
const { swcrcConfig } = require('../transpile/swcrc.config.cjs');
|
|
5
|
+
|
|
6
|
+
let monorepoRoot = null;
|
|
7
|
+
import('../monorepo/utils.js').then(({ findMonoRepoRoot }) => {
|
|
8
|
+
monorepoRoot = findMonoRepoRoot(process.cwd());
|
|
9
|
+
}).catch((ex) => console.error('Error loading monorepo utils:', ex));
|
|
10
|
+
|
|
11
|
+
let isReactModule = true;
|
|
12
|
+
try {
|
|
13
|
+
/* eslint-disable global-require, import/no-unresolved */
|
|
14
|
+
require('react');
|
|
15
|
+
require('styled-components');
|
|
16
|
+
/* eslint-enable global-require, import/no-unresolved */
|
|
17
|
+
} catch (err) {
|
|
18
|
+
isReactModule = false;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const getMockFilePath = (fileName) =>
|
|
22
|
+
normalizePath(path.resolve(__dirname, './mocks', fileName));
|
|
23
|
+
|
|
24
|
+
const getNodeModulesPath = (fileName) => {
|
|
25
|
+
return normalizePath(
|
|
26
|
+
monorepoRoot
|
|
27
|
+
? path.join(monorepoRoot, 'node_modules', fileName)
|
|
28
|
+
: `<rootDir>/node_modules/${fileName}`,
|
|
29
|
+
);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const jestConfig = {
|
|
33
|
+
collectCoverageFrom: [
|
|
34
|
+
'app/**/*.{js,ts,jsx,tsx}',
|
|
35
|
+
'lib/**/*.{js,ts,jsx,tsx}',
|
|
36
|
+
'!app/**/*.d.ts',
|
|
37
|
+
'!lib/**/*.d.ts',
|
|
38
|
+
'!app/**/*.test.{js,ts,jsx,tsx}',
|
|
39
|
+
'!lib/**/*.test.{js,ts,jsx,tsx}',
|
|
40
|
+
'!app/**/*.stories.{js,ts,jsx,tsx}',
|
|
41
|
+
'!lib/**/*.stories.{js,ts,jsx,tsx}',
|
|
42
|
+
'!app/**/*.endpoint.{js,ts,jsx,tsx}',
|
|
43
|
+
'!lib/**/*.endpoint.{js,ts,jsx,tsx}',
|
|
44
|
+
'!app/*/RbGenerated*/*.{js,ts,jsx,tsx}',
|
|
45
|
+
'!app/index.{js,ts,jsx,tsx}',
|
|
46
|
+
'!app/global-styles.{js,ts,jsx,tsx}',
|
|
47
|
+
'!app/**/loadable.{js,ts,jsx,tsx}',
|
|
48
|
+
'!lib/**/loadable.{js,ts,jsx,tsx}',
|
|
49
|
+
],
|
|
50
|
+
coverageThreshold: {
|
|
51
|
+
// Todo: enable the coverage threshold later
|
|
52
|
+
// global: {
|
|
53
|
+
// statements: 95,
|
|
54
|
+
// branches: 90,
|
|
55
|
+
// functions: 95,
|
|
56
|
+
// lines: 95,
|
|
57
|
+
// },
|
|
58
|
+
},
|
|
59
|
+
coverageDirectory: 'reports',
|
|
60
|
+
coverageReporters: ['lcov', 'html', 'text-summary'],
|
|
61
|
+
moduleDirectories: ['node_modules', 'app', 'lib'],
|
|
62
|
+
moduleNameMapper: {
|
|
63
|
+
'.*\\webpack-hmr(.[t|j]s)?$': getMockFilePath('webpack-hmr.cjs'),
|
|
64
|
+
'.*\\.(css|scss)$': getMockFilePath('cssModule.cjs'),
|
|
65
|
+
'.*\\.(jpg|jpeg|png|gif|eot|otf|webp|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga|ico)$':
|
|
66
|
+
getMockFilePath('image.cjs'),
|
|
67
|
+
'.*\\.svg$': getMockFilePath('svg.cjs'),
|
|
68
|
+
'.*\\.(html)$': getMockFilePath('html.cjs'),
|
|
69
|
+
'.*index.html\\?resource$': getMockFilePath('html.cjs'),
|
|
70
|
+
'@elliemae/pui-user-monitoring': getMockFilePath('pui-user-monitoring.cjs'),
|
|
71
|
+
'@elliemae/pui-app-loader': getMockFilePath('pui-app-loader.cjs'),
|
|
72
|
+
'@elliemae/pui-diagnostics': getMockFilePath('pui-diagnostics.cjs'),
|
|
73
|
+
'react-spring/web': getNodeModulesPath('react-spring/web.cjs.js'),
|
|
74
|
+
'react-spring/renderprops': getNodeModulesPath(
|
|
75
|
+
'react-spring/renderprops.cjs.js',
|
|
76
|
+
),
|
|
77
|
+
},
|
|
78
|
+
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
|
|
79
|
+
setupFilesAfterEnv: [path.resolve(__dirname, './setup-tests.js')],
|
|
80
|
+
setupFiles: ['raf/polyfill', 'whatwg-fetch'],
|
|
81
|
+
testRegex: '(app|lib).*/tests/.*\\.test\\.[jt]sx?$',
|
|
82
|
+
snapshotSerializers: [],
|
|
83
|
+
testResultsProcessor: 'jest-sonar-reporter',
|
|
84
|
+
resolver: path.resolve(__dirname, './resolver.cjs'),
|
|
85
|
+
transform: {
|
|
86
|
+
'^.+\\.[jt]sx?$': ['@swc/jest', swcrcConfig],
|
|
87
|
+
},
|
|
88
|
+
transformIgnorePatterns: [
|
|
89
|
+
'node_modules/(?!(.*@elliemae/pui-cli|lodash-es|react-select|react-dates)/)',
|
|
90
|
+
],
|
|
91
|
+
globals: {
|
|
92
|
+
APP_CONFIG: getAppConfig(),
|
|
93
|
+
__webpack_public_path__: '/',
|
|
94
|
+
},
|
|
95
|
+
testEnvironmentOptions: {
|
|
96
|
+
url: `http://localhost:3111${basePath}`,
|
|
97
|
+
},
|
|
98
|
+
testEnvironment: 'jsdom',
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
if (isReactModule && jestConfig.setupFilesAfterEnv)
|
|
102
|
+
jestConfig.setupFilesAfterEnv.push(
|
|
103
|
+
path.resolve(__dirname, './setup-react-env.js'),
|
|
104
|
+
);
|
|
105
|
+
|
|
106
|
+
exports.jestConfig = jestConfig;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
defaults: {},
|
|
3
|
+
interceptors: {
|
|
4
|
+
request: {
|
|
5
|
+
use: jest.fn(),
|
|
6
|
+
},
|
|
7
|
+
response: {
|
|
8
|
+
use: jest.fn(),
|
|
9
|
+
},
|
|
10
|
+
},
|
|
11
|
+
create: jest.fn().mockReturnThis(),
|
|
12
|
+
get: jest.fn().mockResolvedValue({ data: {} }),
|
|
13
|
+
post: jest.fn().mockResolvedValue({ data: {} }),
|
|
14
|
+
put: jest.fn().mockResolvedValue({ data: {} }),
|
|
15
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = 'CSS_MODULE';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = 'HTML_MODULE';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = 'IMAGE_MOCK';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
*/
|
|
4
|
+
export default () => {
|
|
5
|
+
Object.defineProperty(window, 'matchMedia', {
|
|
6
|
+
writable: true,
|
|
7
|
+
value: jest.fn().mockImplementation((query) => ({
|
|
8
|
+
matches: false,
|
|
9
|
+
media: query,
|
|
10
|
+
onchange: null,
|
|
11
|
+
addListener: jest.fn(), // Deprecated
|
|
12
|
+
removeListener: jest.fn(), // Deprecated
|
|
13
|
+
addEventListener: jest.fn(),
|
|
14
|
+
removeEventListener: jest.fn(),
|
|
15
|
+
dispatchEvent: jest.fn(),
|
|
16
|
+
})),
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
Object.defineProperty(window, 'getComputedStyle', {
|
|
20
|
+
value: () => ({
|
|
21
|
+
getPropertyValue: () => {},
|
|
22
|
+
}),
|
|
23
|
+
});
|
|
24
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const load = () => {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export const logger = () => ({
|
|
2
|
+
setLogLevel() {},
|
|
3
|
+
setOptions() {},
|
|
4
|
+
info() {},
|
|
5
|
+
warn() {},
|
|
6
|
+
error() {},
|
|
7
|
+
trace() {},
|
|
8
|
+
debug() {},
|
|
9
|
+
audit() {},
|
|
10
|
+
fatal() {},
|
|
11
|
+
});
|
|
12
|
+
export const LogLevel = {
|
|
13
|
+
info: 'info',
|
|
14
|
+
debug: 'debug',
|
|
15
|
+
trace: 'trace',
|
|
16
|
+
warn: 'warn',
|
|
17
|
+
error: 'error',
|
|
18
|
+
audit: 'audit',
|
|
19
|
+
fatal: 'fatal',
|
|
20
|
+
};
|
|
21
|
+
export const Console = () => ({
|
|
22
|
+
log: () => {},
|
|
23
|
+
});
|
|
24
|
+
export const http = () => ({
|
|
25
|
+
log() {},
|
|
26
|
+
});
|
|
27
|
+
export const webvitals = () => {};
|
|
28
|
+
export const logUnhandledErrors = () => {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
exports.enableHotReloading = () => {};
|