Skip to content

Commit d5e88c4

Browse files
authored
Merge pull request #357 from ckeditor/epic/ck/18475-eslint9
Internal: Upgrade to ESLint 9.x. Closes #356.
2 parents ea05b58 + 93e91d9 commit d5e88c4

16 files changed

+1742
-1427
lines changed

.eslintrc.cjs

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

eslint.config.js

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
/**
2+
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4+
*/
5+
6+
import globals from 'globals';
7+
import { defineConfig } from 'eslint/config';
8+
import ckeditor5Rules from 'eslint-plugin-ckeditor5-rules';
9+
import ckeditor5Config from 'eslint-config-ckeditor5';
10+
import pluginVue from 'eslint-plugin-vue';
11+
import ts from 'typescript-eslint';
12+
13+
export default defineConfig( [
14+
{
15+
ignores: [
16+
'coverage/**',
17+
'dist/**',
18+
'release/**'
19+
]
20+
},
21+
22+
{
23+
extends: ckeditor5Config,
24+
25+
languageOptions: {
26+
ecmaVersion: 'latest',
27+
sourceType: 'module',
28+
globals: {
29+
...globals.browser
30+
}
31+
},
32+
33+
linterOptions: {
34+
reportUnusedDisableDirectives: 'warn',
35+
reportUnusedInlineConfigs: 'warn'
36+
},
37+
38+
plugins: {
39+
'ckeditor5-rules': ckeditor5Rules
40+
},
41+
42+
rules: {
43+
'ckeditor5-rules/license-header': [ 'error', { headerLines: [
44+
'/**',
45+
' * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.',
46+
' * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options',
47+
' */'
48+
] } ],
49+
'ckeditor5-rules/require-file-extensions-in-imports': [
50+
'error',
51+
{
52+
extensions: [ '.ts', '.js', '.json' ]
53+
}
54+
],
55+
'ckeditor5-rules/prevent-license-key-leak': 'error',
56+
'no-unused-vars': 'off'
57+
}
58+
},
59+
60+
// Rules recommended by the Vue plugin that apply to all files.
61+
{
62+
extends: pluginVue.configs[ 'flat/recommended' ],
63+
64+
rules: {
65+
'vue/multi-word-component-names': 'off'
66+
}
67+
},
68+
69+
// Rules specific to `.vue` files.
70+
{
71+
files: [ '**/*.vue' ],
72+
73+
languageOptions: {
74+
parserOptions: {
75+
parser: ts.parser
76+
}
77+
},
78+
79+
rules: {
80+
'ckeditor5-rules/license-header': 'off'
81+
}
82+
},
83+
84+
// Rules specific to `scripts` folder.
85+
{
86+
files: [ 'scripts/**/*' ],
87+
88+
languageOptions: {
89+
globals: {
90+
...globals.node
91+
}
92+
}
93+
}
94+
] );

package.json

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,11 @@
5151
"ckeditor5": "^44.3.0",
5252
"ckeditor5-premium-features": "^44.3.0",
5353
"coveralls": "^3.1.1",
54-
"eslint": "^7.32.0",
55-
"eslint-config-ckeditor5": "^7.1.0",
56-
"eslint-plugin-vue": "^9.9.0",
54+
"eslint": "^9.26.0",
55+
"eslint-config-ckeditor5": "^10.0.0-alpha.0",
56+
"eslint-plugin-ckeditor5-rules": "^10.0.0-alpha.0",
57+
"eslint-plugin-vue": "^10.1.0",
58+
"globals": "^16.1.0",
5759
"husky": "^8.0.2",
5860
"lint-staged": "^10.2.11",
5961
"listr2": "^6.5.0",
@@ -63,7 +65,7 @@
6365
"vite": "^5.3.1",
6466
"vitest": "^2.1.9",
6567
"vue": "^3.4.30",
66-
"vue-eslint-parser": "^9.1.0",
68+
"vue-eslint-parser": "^10.1.3",
6769
"vue-tsc": "^2.1.6",
6870
"webdriverio": "^9.12.7"
6971
},
@@ -74,15 +76,15 @@
7476
"ws": "^8"
7577
},
7678
"engines": {
77-
"node": ">=20.0.0"
79+
"node": ">=22.0.0"
7880
},
7981
"scripts": {
8082
"dev": "vite",
8183
"build": "tsc --noEmit && vite build && vue-tsc --emitDeclarationOnly",
8284
"test": "vitest run --coverage",
8385
"test:watch": "vitest --ui --watch",
8486
"test:check:types": "tsc --noEmit -p ./tests/tsconfig.json",
85-
"lint": "eslint \"{demos,src,tests}/**/*.{ts,vue}\"",
87+
"lint": "eslint",
8688
"postinstall": "node ./scripts/postinstall.js",
8789
"changelog": "node ./scripts/changelog.js",
8890
"release:prepare-packages": "node ./scripts/preparepackages.js",
@@ -104,12 +106,8 @@
104106
"url": "https://github.com/ckeditor/ckeditor5-vue/issues"
105107
},
106108
"homepage": "https://github.com/ckeditor/ckeditor5-vue",
107-
"eslintIgnore": [
108-
"coverage/**",
109-
"dist/**"
110-
],
111109
"lint-staged": {
112-
"**/*.{js,ts,vue}": [
110+
"**/*": [
113111
"eslint --quiet"
114112
]
115113
}

scripts/bump-year.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
66
*/
77

8-
/* eslint-env node */
9-
108
/*
119
1210
Usage:

scripts/changelog.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
66
*/
77

8-
/* eslint-env node */
9-
108
import parseArguments from './utils/parsearguments.js';
119

1210
/**

scripts/ci/is-project-ready-to-release.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
66
*/
77

8-
/* eslint-env node */
9-
108
import { createRequire } from 'module';
119
import * as releaseTools from '@ckeditor/ckeditor5-dev-release-tools';
1210

scripts/postinstall.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
44
*/
55

6-
/* eslint-env node */
7-
86
import { fileURLToPath } from 'url';
97
import { join, dirname } from 'path';
108
import { existsSync } from 'fs';

scripts/preparepackages.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,12 @@
55
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
66
*/
77

8-
/* eslint-env node */
9-
10-
import { createRequire } from 'module';
118
import { Listr } from 'listr2';
129
import * as releaseTools from '@ckeditor/ckeditor5-dev-release-tools';
1310
import * as devUtils from '@ckeditor/ckeditor5-dev-utils';
1411
import parseArguments from './utils/parsearguments.js';
1512
import getListrOptions from './utils/getlistroptions.js';
16-
17-
const require = createRequire( import.meta.url );
13+
import { preparePackageJson } from './utils/preparepackagejson.js';
1814

1915
const latestVersion = releaseTools.getLastFromChangelog();
2016
const versionChangelog = releaseTools.getChangesForVersion( latestVersion );
@@ -73,7 +69,7 @@ const tasks = new Listr( [
7369
task: () => {
7470
return releaseTools.prepareRepository( {
7571
outputDirectory: 'release',
76-
rootPackageJson: require( '../package.json' )
72+
rootPackageJson: preparePackageJson()
7773
} );
7874
}
7975
},

scripts/publishpackages.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
66
*/
77

8-
/* eslint-env node */
9-
108
import { Listr } from 'listr2';
119
import * as releaseTools from '@ckeditor/ckeditor5-dev-release-tools';
1210
import parseArguments from './utils/parsearguments.js';

scripts/utils/getlistroptions.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
44
*/
55

6-
/* eslint-env node */
7-
86
/**
97
* @param {ReleaseOptions} cliArguments
108
* @returns {Object}

scripts/utils/parsearguments.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
44
*/
55

6-
/* eslint-env node */
7-
86
import minimist from 'minimist';
97

108
/**

scripts/utils/preparepackagejson.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/**
2+
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4+
*/
5+
6+
import packageJson from '../../package.json' with { type: 'json' };
7+
8+
export function preparePackageJson() {
9+
if ( packageJson.engines ) {
10+
delete packageJson.engines;
11+
}
12+
13+
return packageJson;
14+
}

src/plugin.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
44
*/
55

6-
/* eslint-env browser */
76
import * as Vue from 'vue';
87
import Ckeditor from './ckeditor.vue';
98

tests/globals.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ declare module '*.vue' {
99
const Component: DefineComponent<object, object, any>;
1010

1111
export default Component;
12-
}
12+
}

vitest-setup.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,4 @@
33
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
44
*/
55

6-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
7-
// @ts-ignore
86
window.CKEDITOR_GLOBAL_LICENSE_KEY = 'GPL';

0 commit comments

Comments
 (0)