@enact/cli 7.0.0-alpha.4 → 7.0.0-alpha.5
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/CHANGELOG.md +6 -0
- package/commands/eject.js +2 -2
- package/commands/lint.js +2 -2
- package/commands/pack.js +2 -1
- package/config/eslintWebpackPluginConfig.js +30 -0
- package/config/webpack.config.js +2 -31
- package/eslint.config.js +47 -0
- package/npm-shrinkwrap.json +24098 -64738
- package/package.json +9 -8
- package/.eslintrc.js +0 -29
package/CHANGELOG.md
CHANGED
package/commands/eject.js
CHANGED
|
@@ -44,7 +44,7 @@ const bareTasks = {
|
|
|
44
44
|
'pack-p': 'webpack --env production --config config/webpack.config.js && cpy public dist',
|
|
45
45
|
watch: 'cpy public dist && webpack --env development --config config/webpack.config.js --watch',
|
|
46
46
|
clean: 'rimraf build dist',
|
|
47
|
-
lint: 'eslint --no-
|
|
47
|
+
lint: 'eslint --no-config-lookup --config enact --ignore-pattern config/* .',
|
|
48
48
|
license: 'license-checker ',
|
|
49
49
|
test: 'jest --config config/jest/jest.config.js',
|
|
50
50
|
'test-watch': 'jest --config config/jest/jest.config.js --watch'
|
|
@@ -216,7 +216,7 @@ function configurePackage(bare) {
|
|
|
216
216
|
app.eslintConfig = eslintConfig;
|
|
217
217
|
app.eslintIgnore = app.eslintIgnore || [];
|
|
218
218
|
app.eslintIgnore = app.eslintIgnore.concat(eslintIgnore.filter(l => !app.eslintIgnore.includes(l)));
|
|
219
|
-
backupOld(['.eslintignore', '.
|
|
219
|
+
backupOld(['.eslintignore', 'eslint.config.js']);
|
|
220
220
|
|
|
221
221
|
// Sort the package.json output
|
|
222
222
|
['dependencies', 'devDependencies'].forEach(obj => {
|
package/commands/lint.js
CHANGED
|
@@ -37,9 +37,9 @@ function shouldESLint() {
|
|
|
37
37
|
function eslint({strict = false, local = false, fix = false, eslintArgs = []} = {}) {
|
|
38
38
|
let args = [];
|
|
39
39
|
if (strict) {
|
|
40
|
-
args.push('--no-
|
|
40
|
+
args.push('--no-config-lookup', '--config', require.resolve('eslint-config-enact/strict'));
|
|
41
41
|
} else if (!local) {
|
|
42
|
-
args.push('--no-
|
|
42
|
+
args.push('--no-config-lookup', '--config', require.resolve('eslint-config-enact'));
|
|
43
43
|
}
|
|
44
44
|
if (local) {
|
|
45
45
|
args.push('--ignore-pattern', '**/node_modules/*');
|
package/commands/pack.js
CHANGED
|
@@ -252,6 +252,8 @@ function api(opts = {}) {
|
|
|
252
252
|
app.applyEnactMeta({template: path.join(__dirname, '..', 'config', 'custom-skin-template.ejs')});
|
|
253
253
|
}
|
|
254
254
|
|
|
255
|
+
// make the framework option available globally in order to be used by the eslint-webpack-plugin custom configuration
|
|
256
|
+
process.env.FRAMEWORK = opts.framework;
|
|
255
257
|
// Do this as the first thing so that any code reading it knows the right env.
|
|
256
258
|
const configFactory = require('../config/webpack.config');
|
|
257
259
|
const config = configFactory(
|
|
@@ -260,7 +262,6 @@ function api(opts = {}) {
|
|
|
260
262
|
opts.isomorphic,
|
|
261
263
|
!opts.animation,
|
|
262
264
|
!opts['split-css'],
|
|
263
|
-
opts.framework,
|
|
264
265
|
opts['ilib-additional-path']
|
|
265
266
|
);
|
|
266
267
|
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const eslintConfigEnact = require('eslint-config-enact/index');
|
|
2
|
+
const eslintConfigEnactStrict = require('eslint-config-enact/strict');
|
|
3
|
+
|
|
4
|
+
// Check if JSX transform is able
|
|
5
|
+
const hasJsxRuntime = (() => {
|
|
6
|
+
if (process.env.DISABLE_NEW_JSX_TRANSFORM === 'true') {
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
try {
|
|
11
|
+
require.resolve('react/jsx-runtime');
|
|
12
|
+
return true;
|
|
13
|
+
} catch (e) {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
})();
|
|
17
|
+
|
|
18
|
+
const loadedEnactConfig = process.env.FRAMEWORK ? eslintConfigEnactStrict : eslintConfigEnact;
|
|
19
|
+
|
|
20
|
+
module.exports = [
|
|
21
|
+
...loadedEnactConfig,
|
|
22
|
+
{
|
|
23
|
+
rules: {
|
|
24
|
+
...(!hasJsxRuntime && {
|
|
25
|
+
'react/jsx-uses-react': 'warn',
|
|
26
|
+
'react/react-in-jsx-scope': 'warn'
|
|
27
|
+
})
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
];
|
package/config/webpack.config.js
CHANGED
|
@@ -46,7 +46,6 @@ module.exports = function (
|
|
|
46
46
|
isomorphic = false,
|
|
47
47
|
noAnimation = false,
|
|
48
48
|
noSplitCSS = false,
|
|
49
|
-
framework = false,
|
|
50
49
|
ilibAdditionalResourcesPath
|
|
51
50
|
) {
|
|
52
51
|
process.chdir(app.context);
|
|
@@ -57,20 +56,6 @@ module.exports = function (
|
|
|
57
56
|
// Sets the browserslist default fallback set of browsers to the Enact default browser support list.
|
|
58
57
|
app.setEnactTargetsAsDefault();
|
|
59
58
|
|
|
60
|
-
// Check if JSX transform is able
|
|
61
|
-
const hasJsxRuntime = (() => {
|
|
62
|
-
if (process.env.DISABLE_NEW_JSX_TRANSFORM === 'true') {
|
|
63
|
-
return false;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
try {
|
|
67
|
-
require.resolve('react/jsx-runtime');
|
|
68
|
-
return true;
|
|
69
|
-
} catch (e) {
|
|
70
|
-
return false;
|
|
71
|
-
}
|
|
72
|
-
})();
|
|
73
|
-
|
|
74
59
|
// Check if TypeScript is setup
|
|
75
60
|
const useTypeScript = fs.existsSync('tsconfig.json');
|
|
76
61
|
|
|
@@ -587,26 +572,12 @@ module.exports = function (
|
|
|
587
572
|
}),
|
|
588
573
|
new ESLintPlugin({
|
|
589
574
|
// Plugin options
|
|
575
|
+
configType: 'flat',
|
|
590
576
|
extensions: ['js', 'mjs', 'jsx', 'ts', 'tsx'],
|
|
591
577
|
formatter: require.resolve('react-dev-utils/eslintFormatter'),
|
|
592
578
|
eslintPath: require.resolve('eslint'),
|
|
593
|
-
// ESLint class options
|
|
594
|
-
resolvePluginsRelativeTo: __dirname,
|
|
595
579
|
// @remove-on-eject-begin
|
|
596
|
-
|
|
597
|
-
extends: [
|
|
598
|
-
framework
|
|
599
|
-
? require.resolve('eslint-config-enact/strict.js')
|
|
600
|
-
: require.resolve('eslint-config-enact/index.js')
|
|
601
|
-
],
|
|
602
|
-
rules: {
|
|
603
|
-
...(!hasJsxRuntime && {
|
|
604
|
-
'react/jsx-uses-react': 'warn',
|
|
605
|
-
'react/react-in-jsx-scope': 'warn'
|
|
606
|
-
})
|
|
607
|
-
}
|
|
608
|
-
},
|
|
609
|
-
useEslintrc: false,
|
|
580
|
+
overrideConfigFile: require.resolve('./eslintWebpackPluginConfig'),
|
|
610
581
|
// @remove-on-eject-end
|
|
611
582
|
cache: true
|
|
612
583
|
})
|
package/eslint.config.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
const enactConfig = require('eslint-config-enact');
|
|
2
|
+
const prettierConfig = require('eslint-config-prettier');
|
|
3
|
+
const importPlugin = require('eslint-plugin-import');
|
|
4
|
+
const prettierPlugin = require('eslint-plugin-prettier');
|
|
5
|
+
const globals = require('globals');
|
|
6
|
+
|
|
7
|
+
module.exports = [
|
|
8
|
+
...enactConfig,
|
|
9
|
+
{
|
|
10
|
+
languageOptions: {
|
|
11
|
+
ecmaVersion: 'latest',
|
|
12
|
+
sourceType: 'module',
|
|
13
|
+
globals: {
|
|
14
|
+
...globals.node
|
|
15
|
+
},
|
|
16
|
+
parserOptions: {
|
|
17
|
+
ecmaFeatures: {
|
|
18
|
+
jsx: true
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
plugins: {
|
|
23
|
+
import: importPlugin,
|
|
24
|
+
prettier: prettierPlugin
|
|
25
|
+
},
|
|
26
|
+
rules: {
|
|
27
|
+
// import plugin rules
|
|
28
|
+
'import/no-unresolved': ['error', {commonjs: true, caseSensitive: true}],
|
|
29
|
+
'import/named': 'error',
|
|
30
|
+
'import/first': 'warn',
|
|
31
|
+
'import/no-duplicates': 'error',
|
|
32
|
+
'import/extensions': ['warn', 'always', {js: 'never', json: 'always'}],
|
|
33
|
+
'import/newline-after-import': 'warn',
|
|
34
|
+
'import/order': [
|
|
35
|
+
'warn',
|
|
36
|
+
{
|
|
37
|
+
'newlines-between': 'never',
|
|
38
|
+
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index']
|
|
39
|
+
}
|
|
40
|
+
],
|
|
41
|
+
|
|
42
|
+
// prettier rules
|
|
43
|
+
...prettierPlugin.configs.recommended.rules,
|
|
44
|
+
...prettierConfig.rules
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
];
|