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

chore(deps): upgrade ESLint to v9 #200

Merged
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
49 changes: 0 additions & 49 deletions .eslintrc

This file was deleted.

67 changes: 67 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import globals from "globals";
import js from "@eslint/js";
import jest from "eslint-plugin-jest";
import eslintConfigPrettier from "eslint-config-prettier";

/**
* @type {import("eslint").Linter.Config}
*/
export default [
{
"ignores": [".git/", ".github/", ".husky/", ".scannerwork/", ".vscode/", "coverage/", "node_modules/"],
"name": "Files to ignore"
},
{
...eslintConfigPrettier,
"name": "Prettier"
},
{
...js.configs.recommended,
"files": ["**/*.{js,cjs,mjs}"],
"languageOptions": {
"ecmaVersion": 2023
},
"name": "JavaScript files",
"rules": {
...js.configs.recommended.rules,
"no-var": "error",
"no-unused-vars": [
"error",
{
"argsIgnorePattern": "_.*"
}
]
}
},
{
"files": ["**/*.mjs"],
"languageOptions": {
"sourceType": "module"
},
"name": "JavaScript modules"
},
{
"files": ["**/*.{js,cjs,mjs}"],
"languageOptions": {
"globals": {
...globals.node
}
},
"name": "Node.js files"
},
{
...jest.configs["flat/recommended"],
"files": ["test/**/*{spec,test}.{js,cjs,mjs}", "test/mocks/jest-mocks.js"],
"languageOptions": {
"globals": {
...globals.jest
}
},
"name": "Test files",
"rules": {
...jest.configs["flat/recommended"].rules,
"jest/prefer-expect-assertions": "off",
"jest/expect-expect": "off"
}
}
];
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ module.exports = async function standardVersion(argv) {
: false,
};
break;
// eslint-disable-next-line no-unused-vars
} catch (err) {
/* This probably shouldn't be empty? */
}
Expand Down
14 changes: 8 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
"description": "replacement for `npm version` with automatic CHANGELOG generation",
"bin": "bin/cli.js",
"scripts": {
"fix": "eslint . --fix",
"posttest": "eslint . && npm run format:check",
"eslint": "eslint .",
"eslint:fix": "npm run eslint -- --fix",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. Thanks for splitting this out.

What do you think of lint instead of eslint?

I usually use the name of what it's for, rather than the name of the tool - that way you don't need to remember whether the project has different tools. What do you think?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've made this change on master, assuming it wouldn't be terribly contentious

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's fine for me. There are some cases where there is more than one linter (eg Stylelint + ESLint). In that scenario, a "lint" script usually calls all the other scripts.

In this case, your suggestion makes sense given that ESLint is the only linter in this project (omitting prettier).

"posttest": "npm run eslint && npm run format:check",
"format:base": "prettier \"./**/*.{ts,js}\"",
"format:fix": "npm run format:base -- --write",
"format:check": "npm run format:base -- --check",
Expand Down Expand Up @@ -56,12 +57,13 @@
"yargs": "^17.7.2"
},
"devDependencies": {
"eslint": "^8.57.1",
"@eslint/js": "^9.13.0",
"eslint": "^9.13.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-jest": "^27.9.0",
"eslint-plugin-n": "^15.7.0",
"eslint-plugin-promise": "^6.6.0",
"eslint-plugin-jest": "^28.8.3",
"eslint-plugin-n": "^17.11.1",
"eslint-plugin-promise": "^7.1.0",
"jest": "^29.7.0",
"jest-serial-runner": "^1.2.1",
"prettier": "^3.3.3",
Expand Down