Skip to content

Commit 889dbb5

Browse files
authored
refactor: Upgrade to eslint 9.19.0 (parse-community#9580)
1 parent 239e692 commit 889dbb5

18 files changed

+1260
-765
lines changed

.eslintignore

-3
This file was deleted.

.eslintrc.json

-35
This file was deleted.

.releaserc.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,12 @@ async function config() {
3030

3131
// Get branch
3232
const branch = ref?.split('/')?.pop()?.split('-')[0] || '(current branch could not be determined)';
33+
// eslint-disable-next-line no-console
3334
console.log(`Running on branch: ${branch}`);
3435

3536
// Set changelog file
3637
const changelogFile = `./changelogs/CHANGELOG_${branch}.md`;
38+
// eslint-disable-next-line no-console
3739
console.log(`Changelog file output to: ${changelogFile}`);
3840

3941
// Load template file contents
@@ -108,7 +110,7 @@ async function config() {
108110

109111
async function loadTemplates() {
110112
for (const template of Object.keys(templates)) {
111-
113+
112114
// For ES6 modules use:
113115
// const fileUrl = import.meta.url;
114116
// const __dirname = dirname(fileURLToPath(fileUrl));

ci/CiVersionCheck.js

+2
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ class CiVersionCheck {
220220
* Runs the check.
221221
*/
222222
async check() {
223+
/* eslint-disable no-console */
223224
try {
224225
console.log(`\nChecking ${this.packageName} versions in CI environments...`);
225226

@@ -284,6 +285,7 @@ class CiVersionCheck {
284285
const msg = `Failed to check ${this.packageName} versions with error: ${e}`;
285286
core.setFailed(msg);
286287
}
288+
/* eslint-enable no-console */
287289
}
288290
}
289291

ci/definitionsCheck.js

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const util = require('util');
1414
fs.readFile('./src/Options/docs.js', 'utf8'),
1515
]);
1616
if (currentDefinitions !== newDefinitions || currentDocs !== newDocs) {
17+
// eslint-disable-next-line no-console
1718
console.error(
1819
'\x1b[31m%s\x1b[0m',
1920
'Definitions files cannot be updated manually. Please update src/Options/index.js then run `npm run definitions` to generate definitions.'

ci/nodeEngineCheck.js

+3
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ class NodeEngineCheck {
8787
nodeVersion: version
8888
});
8989
} catch(e) {
90+
// eslint-disable-next-line no-console
9091
console.log(`Ignoring file because it is not valid JSON: ${file}`);
9192
core.warning(`Ignoring file because it is not valid JSON: ${file}`);
9293
}
@@ -171,6 +172,7 @@ async function check() {
171172
// Get highest version
172173
const highestVersion = higherVersions.map(v => v.nodeMinVersion).pop();
173174

175+
/* eslint-disable no-console */
174176
// If there are higher versions
175177
if (higherVersions.length > 0) {
176178
console.log(`\nThere are ${higherVersions.length} dependencies that require a higher node engine version than the parent package (${parentVersion.nodeVersion}):`);
@@ -189,6 +191,7 @@ async function check() {
189191
}
190192

191193
console.log(`✅ All dependencies satisfy the node version requirement of the parent package (${parentVersion.nodeVersion}).`);
194+
/* eslint-enable no-console */
192195
}
193196

194197
check();

eslint.config.js

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
const js = require("@eslint/js");
2+
const babelParser = require("@babel/eslint-parser");
3+
const globals = require("globals");
4+
module.exports = [
5+
{
6+
ignores: ["**/lib/**", "**/coverage/**", "**/out/**"],
7+
},
8+
js.configs.recommended,
9+
{
10+
languageOptions: {
11+
parser: babelParser,
12+
ecmaVersion: 6,
13+
sourceType: "module",
14+
globals: {
15+
Parse: "readonly",
16+
...globals.node,
17+
},
18+
parserOptions: {
19+
requireConfigFile: false,
20+
},
21+
},
22+
rules: {
23+
indent: ["error", 2, { SwitchCase: 1 }],
24+
"linebreak-style": ["error", "unix"],
25+
"no-trailing-spaces": "error",
26+
"eol-last": "error",
27+
"space-in-parens": ["error", "never"],
28+
"no-multiple-empty-lines": "warn",
29+
"prefer-const": "error",
30+
"space-infix-ops": "error",
31+
"no-useless-escape": "off",
32+
"require-atomic-updates": "off",
33+
"object-curly-spacing": ["error", "always"],
34+
curly: ["error", "all"],
35+
"block-spacing": ["error", "always"],
36+
"no-unused-vars": "off",
37+
"no-console": "warn"
38+
},
39+
},
40+
];

0 commit comments

Comments
 (0)