Skip to content

Commit

Permalink
Upgrade to ESLint 9
Browse files Browse the repository at this point in the history
  • Loading branch information
Alkarex committed Aug 2, 2024
1 parent 2ba65f4 commit 5fd2744
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 43 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ trim_trailing_whitespace = true
[*.html]
indent_style = tab

[*.js]
[*.{js,mjs}]
indent_style = tab

[*.json]
Expand Down
32 changes: 0 additions & 32 deletions .eslintrc.json

This file was deleted.

1 change: 1 addition & 0 deletions .markdownlint.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"no-multiple-blanks": {
"maximum": 2
},
"no-trailing-spaces": true,
"ul-indent": false,
"ul-style": {
"style": "consistent"
Expand Down
2 changes: 2 additions & 0 deletions .markdownlintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.git/
node_modules/
61 changes: 61 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import globals from "globals";
import html from "eslint-plugin-html";
import js from "@eslint/js";
import neostandard, { resolveIgnoresFromGitignore } from 'neostandard';
import stylistic from '@stylistic/eslint-plugin';

export default [
{
files: ["**/*.js"],
languageOptions: {
globals: {
...globals.browser,
},
sourceType: "script",
},
},
{
files: ["**/*.html"],
plugins: { html },
settings: {
"html/indent": "tab",
"html/report-bad-indent": "error",
},
},
{
ignores: [
...resolveIgnoresFromGitignore(),
],
},
js.configs.recommended,
// stylistic.configs['recommended-flat'],
...neostandard(),
{
plugins: {
"@stylistic": stylistic,
},
rules: {
"camelcase": "off",
"eqeqeq": "off",
"no-empty": ["error", { "allowEmptyCatch": true }],
"no-unused-vars": ["error", {
"args": "none",
"caughtErrors": "none",
}],
"object-shorthand": ["warn", "consistent"],
"yoda": "off",
"@stylistic/indent": ["warn", "tab", { "SwitchCase": 1 }],
"@stylistic/linebreak-style": ["error", "unix"],
"@stylistic/max-len": ["warn", 165],
"@stylistic/no-tabs": "off",
"@stylistic/quotes": ["off", "single", { "avoidEscape": true }],
"@stylistic/quote-props": ["warn", "consistent"],
"@stylistic/semi": ["warn", "always"],
"@stylistic/space-before-function-paren": ["warn", {
"anonymous": "always",
"asyncArrow": "always",
"named": "never",
}],
},
},
];
23 changes: 13 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,22 @@
"url": "https://github.com/alexandrainst/node-red-contrib-mock-cli.git"
},
"devDependencies": {
"eslint": "^8.53.0",
"eslint-config-standard": "^17.1.0",
"eslint-plugin-html": "^8.0.0",
"eslint-plugin-import": "^2.29.0",
"eslint-plugin-n": "^16.2.0",
"eslint-plugin-promise": "^6.1.1"
"eslint": "^9.8.0",
"@eslint/js": "^9.8.0",
"eslint-plugin-html": "^8.1.1",
"globals": "^15.9.0",
"markdownlint-cli": "^0.41.0",
"neostandard": "^0.11.2",
"node-red-contrib-mock-cli": "^1.4.1"
},
"scripts": {
"eslint": "eslint .",
"eslint_fix": "eslint --fix .",
"markdownlint": "markdownlint '**/*.md'",
"markdownlint_fix": "markdownlint --fix '**/*.md'",
"fix": "npm run rtlcss && npm run eslint_fix && npm run markdownlint_fix",
"pretest": "npm run eslint && npm run markdownlint",
"start": "node ./index.js",
"eslint": "eslint --ext .js,.html .",
"eslint_fix": "eslint --fix --ext .js,.html .",
"fix": "npm run eslint_fix",
"pretest": "npm run-script eslint",
"test": "echo '{\"payload\":3}' | node ./test.js test-node --multiplyBy='5' | grep -q '{\"payload\":15}' && echo 'OK'"
}
}

0 comments on commit 5fd2744

Please sign in to comment.