Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Upgrade to eslint 9.19.0 #9580

Merged
merged 2 commits into from
Feb 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .eslintignore

This file was deleted.

35 changes: 0 additions & 35 deletions .eslintrc.json

This file was deleted.

4 changes: 3 additions & 1 deletion .releaserc.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@ async function config() {

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

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

// Load template file contents
Expand Down Expand Up @@ -108,7 +110,7 @@ async function config() {

async function loadTemplates() {
for (const template of Object.keys(templates)) {

// For ES6 modules use:
// const fileUrl = import.meta.url;
// const __dirname = dirname(fileURLToPath(fileUrl));
Expand Down
2 changes: 2 additions & 0 deletions ci/CiVersionCheck.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ class CiVersionCheck {
* Runs the check.
*/
async check() {
/* eslint-disable no-console */
try {
console.log(`\nChecking ${this.packageName} versions in CI environments...`);

Expand Down Expand Up @@ -284,6 +285,7 @@ class CiVersionCheck {
const msg = `Failed to check ${this.packageName} versions with error: ${e}`;
core.setFailed(msg);
}
/* eslint-enable no-console */
}
}

Expand Down
1 change: 1 addition & 0 deletions ci/definitionsCheck.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const util = require('util');
fs.readFile('./src/Options/docs.js', 'utf8'),
]);
if (currentDefinitions !== newDefinitions || currentDocs !== newDocs) {
// eslint-disable-next-line no-console
console.error(
'\x1b[31m%s\x1b[0m',
'Definitions files cannot be updated manually. Please update src/Options/index.js then run `npm run definitions` to generate definitions.'
Expand Down
3 changes: 3 additions & 0 deletions ci/nodeEngineCheck.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ class NodeEngineCheck {
nodeVersion: version
});
} catch(e) {
// eslint-disable-next-line no-console
console.log(`Ignoring file because it is not valid JSON: ${file}`);
core.warning(`Ignoring file because it is not valid JSON: ${file}`);
}
Expand Down Expand Up @@ -171,6 +172,7 @@ async function check() {
// Get highest version
const highestVersion = higherVersions.map(v => v.nodeMinVersion).pop();

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

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

check();
40 changes: 40 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
const js = require("@eslint/js");
const babelParser = require("@babel/eslint-parser");
const globals = require("globals");
module.exports = [
{
ignores: ["**/lib/**", "**/coverage/**", "**/out/**"],
},
js.configs.recommended,
{
languageOptions: {
parser: babelParser,
ecmaVersion: 6,
sourceType: "module",
globals: {
Parse: "readonly",
...globals.node,
},
parserOptions: {
requireConfigFile: false,
},
},
rules: {
indent: ["error", 2, { SwitchCase: 1 }],
"linebreak-style": ["error", "unix"],
"no-trailing-spaces": "error",
"eol-last": "error",
"space-in-parens": ["error", "never"],
"no-multiple-empty-lines": "warn",
"prefer-const": "error",
"space-infix-ops": "error",
"no-useless-escape": "off",
"require-atomic-updates": "off",
"object-curly-spacing": ["error", "always"],
curly: ["error", "all"],
"block-spacing": ["error", "always"],
"no-unused-vars": "off",
"no-console": "warn"
},
},
];
Loading
Loading