Skip to content

Commit 3559739

Browse files
chore: migrate monorepo to eslint v9 (#17934)
* chore: migrate to eslint v9 * chore: make more changes for eslint v9 migration * chore: enable cache for eslint * chore(vite-plugin): consolidate eslint config * chore: adjust jsconfig files * chore(docs): remove outdated stylintrc file which was for Stylus * chore: include all projects in VS Code ESLint extension and simplify it by using mode: auto * chore: exclude dist directories from VS Code search * chore: remove failing postinstall script which runs quasar prepare, which requires ui package to be built due to logic in vite-plugin removing at least until #17935 gets merged * chore: rename prepare to prepare:types to avoid unintentional runs forgot prepare was a special script
1 parent ed0bf69 commit 3559739

File tree

100 files changed

+3422
-1815
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+3422
-1815
lines changed

.eslintignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

.eslintrc.cjs

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

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@ ui/.vscode/
99
node_modules/
1010
yarn.lock
1111
package-lock.json
12+
13+
.eslintcache

.vscode/settings.json

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,15 @@
22
"eslint.format.enable": false,
33
"editor.formatOnSave": false,
44
"eslint.workingDirectories": [
5-
"./app-vite",
6-
"./app-webpack",
7-
"./cli",
8-
"./create-quasar",
9-
"./docs",
10-
"./ui",
11-
"./utils/render-ssr-error",
12-
"./utils/ssl-certificate",
13-
"./vite-plugin"
5+
{ "mode": "auto" }
146
],
157
"editor.tabSize": 2,
168
"editor.codeActionsOnSave": {
179
"source.fixAll.eslint": "explicit"
1810
},
19-
"eslint.validate": ["javascript", "vue"]
11+
"eslint.validate": ["javascript", "vue"],
12+
13+
"search.exclude": {
14+
"**/dist": true,
15+
}
2016
}

app-vite/.eslintignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

app-vite/.eslintrc.cjs

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

app-vite/eslint.config.js

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
// eslint-disable-next-line n/no-extraneous-import
2+
import eslintJs from '@eslint/js'
3+
import quasar from 'eslint-config-quasar'
4+
// eslint-disable-next-line n/no-extraneous-import
5+
import globals from 'globals'
6+
7+
/** @type {import('eslint').Linter.Config[]} */
8+
export default [
9+
{
10+
name: 'eslint/recommended',
11+
12+
...eslintJs.configs.recommended
13+
},
14+
15+
...quasar.configs.base,
16+
17+
{
18+
ignores: [
19+
'templates',
20+
]
21+
},
22+
23+
{
24+
languageOptions: {
25+
sourceType: 'module'
26+
},
27+
28+
rules: {
29+
'no-useless-escape': 'off',
30+
'no-unused-vars': [ 'error', { ignoreRestSiblings: true, argsIgnorePattern: '^_', caughtErrorsIgnorePattern: '^_' } ]
31+
}
32+
},
33+
34+
...[
35+
...quasar.configs.node
36+
].map(({ name: _, ...config }) => ({
37+
...config,
38+
files: [ '**/*.js' ],
39+
ignores: [ 'exports/bex/**/*.js' ]
40+
})),
41+
{
42+
files: [ '**/*.js' ],
43+
ignores: [ 'exports/bex/**/*.js' ],
44+
45+
languageOptions: {
46+
sourceType: 'module',
47+
ecmaVersion: 2022, // needs to be explicitly stated for some reason
48+
// TODO: ^ verify if it's still needed
49+
50+
globals: {
51+
...globals.es2022,
52+
// ...globals.es2023, // node 22 and above
53+
}
54+
},
55+
},
56+
57+
{
58+
files: [ '**/*.cjs' ],
59+
languageOptions: {
60+
parserOptions: {
61+
sourceType: 'commonjs',
62+
ecmaVersion: 'latest'
63+
}
64+
}
65+
},
66+
67+
{
68+
files: [ 'exports/bex/**/*.js' ],
69+
languageOptions: {
70+
parserOptions: {
71+
ecmaVersion: 'latest',
72+
},
73+
globals: {
74+
...globals.browser,
75+
...globals.webextensions
76+
}
77+
}
78+
}
79+
]

app-vite/lib/app-extension/api-classes/InstallAPI.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ export class InstallAPI extends BaseAPI {
158158
fs.readFileSync(source, 'utf-8')
159159
)
160160
}
161-
catch (e) {
161+
catch (_) {
162162
warn(`Extension(${ this.extId }): extendPackageJson() - "${ extPkg }" is malformed`)
163163
warn()
164164
process.exit(1)
@@ -217,7 +217,7 @@ export class InstallAPI extends BaseAPI {
217217
'utf-8'
218218
)
219219
}
220-
catch (e) {
220+
catch (_) {
221221
warn()
222222
warn(`Extension(${ this.extId }): extendJsonFile() - "${ filePath }" doesn't conform to JSON format: this could happen if you are trying to update flavoured JSON files (eg. JSON with Comments or JSON5). Skipping...`)
223223
warn(`Extension(${ this.extId }): extendJsonFile() - The extension tried to apply these updates to "${ filePath }" file: ${ JSON.stringify(newData) }`)

app-vite/lib/cmd/info.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ function getSpawnOutput (command) {
3737
? green(String(child.output[ 1 ]).trim())
3838
: gray('Not installed')
3939
}
40-
catch (err) {
40+
catch (_) {
4141
return gray('Not installed')
4242
}
4343
}

app-vite/lib/modes/capacitor/ensure-consistency.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export async function ensureDeps ({ appPaths, cacheProxy }) {
2121
nodePackager.install({
2222
cwd: appPaths.capacitorDir,
2323
// See https://github.com/orgs/pnpm/discussions/4735
24-
params: nodePackager.name === 'pnpm' ? ['i', '--ignore-workspace'] : undefined,
24+
params: nodePackager.name === 'pnpm' ? [ 'i', '--ignore-workspace' ] : undefined,
2525
displayName: 'Capacitor'
2626
})
2727
}

0 commit comments

Comments
 (0)