Skip to content

Commit dc7d7c5

Browse files
Upgrade ESLint and streamline JS dependency structure (#3295)
The primary purpose of this PR is to upgrade ESLint and address new linter errors. In doing so, I also added explicit imports for all JS libraries, resolving a longstanding nuisance.
1 parent 41db0f6 commit dc7d7c5

30 files changed

+824
-398
lines changed

.eslintignore

Lines changed: 0 additions & 46 deletions
This file was deleted.

.eslintrc.js

Lines changed: 0 additions & 34 deletions
This file was deleted.

cypress.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ module.exports = defineConfig({
1212
defaultCommandTimeout: 120000,
1313
retries: 2,
1414
e2e: {
15-
setupNodeEvents(on, config) {
15+
setupNodeEvents() {
1616
// implement node event listeners here
1717
},
1818
baseUrl: 'http://localhost:8080',

eslint.config.mjs

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
import js from '@eslint/js';
2+
import globals from 'globals';
3+
import pluginVue from 'eslint-plugin-vue';
4+
import pluginCypress from 'eslint-plugin-cypress';
5+
import pluginJest from 'eslint-plugin-jest';
6+
import { defineConfig, globalIgnores } from 'eslint/config';
7+
8+
export default defineConfig([
9+
js.configs.recommended,
10+
pluginVue.configs['flat/essential'],
11+
12+
globalIgnores([
13+
'vendor/*',
14+
'_build/*',
15+
'cypress_cache/*',
16+
'public/assets/*',
17+
'public/vendor/*',
18+
'resources/js/angular/*',
19+
'**/__mocks__/**',
20+
]),
21+
22+
{
23+
files: ['**/*.{js,mjs,cjs,vue}'],
24+
languageOptions: {
25+
globals: {
26+
...globals.browser,
27+
},
28+
},
29+
rules: {
30+
'indent': ['error', 2],
31+
'vue/no-v-html': 'off',
32+
'vue/require-v-for-key': 'off',
33+
'eqeqeq': ['error', 'always'],
34+
'arrow-spacing': ['error'],
35+
'block-spacing': ['error'],
36+
'brace-style': ['error', 'stroustrup'],
37+
'comma-dangle': ['error', 'always-multiline'],
38+
'curly' : ['error'],
39+
'default-param-last': ['error'],
40+
'eol-last': ['error'],
41+
'keyword-spacing': ['error', {'before': true, 'after': true}],
42+
'space-before-blocks': ['error', 'always'],
43+
'linebreak-style': ['error', 'unix'],
44+
'no-trailing-spaces': ['error'],
45+
'no-var': ['error'],
46+
'prefer-arrow-callback': ['error'],
47+
'prefer-const': ['error'],
48+
'prefer-template': ['error'],
49+
'quotes': ['error', 'single', {'avoidEscape': true}],
50+
'semi': ['error', 'always'],
51+
'semi-style': ['error', 'last'],
52+
'template-curly-spacing': ['error', 'never'],
53+
},
54+
},
55+
{
56+
files: ['**/cypress/**/*.js'],
57+
...pluginCypress.configs.globals,
58+
},
59+
{
60+
files: ['**/*.spec.js'],
61+
plugins: {
62+
jest: pluginJest,
63+
},
64+
languageOptions: {
65+
globals: {
66+
...globals.node,
67+
...pluginJest.environments.globals.globals,
68+
},
69+
},
70+
},
71+
{
72+
files: [
73+
'**/postcss.config.js',
74+
'**/babel.config.js',
75+
'**/jest.config.js',
76+
],
77+
languageOptions: {
78+
globals: {
79+
...globals.node,
80+
},
81+
},
82+
},
83+
{
84+
files: [
85+
'**/webpack.mix.js',
86+
'**/tailwind.config.js',
87+
'**/cypress.config.js',
88+
],
89+
languageOptions: {
90+
sourceType: 'commonjs',
91+
globals: {
92+
...globals.node,
93+
},
94+
},
95+
}
96+
]);

jest.config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ module.exports = {
1010
'^.+\\.vue$': '@vue/vue3-jest',
1111
},
1212
transformIgnorePatterns: [
13-
'/node_modules/(?!echarts|zrender)/',
13+
'/node_modules/(?!echarts|zrender|jquery)/',
1414
],
15+
moduleNameMapper: {
16+
'flot': '<rootDir>/tests/__mocks__/fileMock.js',
17+
},
1518
};

0 commit comments

Comments
 (0)