Skip to content

Commit

Permalink
Merge pull request #37 from AFASSoftware/eslint
Browse files Browse the repository at this point in the history
Eslint v9 upgrade
  • Loading branch information
jvanoostveen authored Sep 19, 2024
2 parents 683ea61 + f291677 commit d97959a
Show file tree
Hide file tree
Showing 10 changed files with 368 additions and 416 deletions.
11 changes: 0 additions & 11 deletions .eslintignore

This file was deleted.

75 changes: 0 additions & 75 deletions .eslintrc.js

This file was deleted.

100 changes: 100 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
// @ts-check

import eslint from "@eslint/js";
import tsEslint from "typescript-eslint";
import unusedImports from "eslint-plugin-unused-imports";

export default tsEslint.config(
{
ignores: [
"build/",
"dist/",
".vscode/",
"node_modules/",
"templates/",
"public/",
".circleci/",
],
},
{
files: ["src/**/*.ts", "test/**/*.ts"],
extends: [
eslint.configs.recommended,
...tsEslint.configs.recommendedTypeChecked,
],
plugins: {
"unused-imports": unusedImports,
},
rules: {
// Additional rules:
...{
eqeqeq: "error",
"no-console": "error",
"prefer-template": "error",
"@typescript-eslint/no-shadow": "error",
"no-unreachable": "error",
"unused-imports/no-unused-imports": "warn",
},

// Additional config for rules:
...{
"@typescript-eslint/explicit-module-boundary-types": [
"error",
{ allowArgumentsExplicitlyTypedAsAny: true },
],
"@typescript-eslint/no-unused-vars": [
"warn",
{ args: "none", caughtErrors: "none" },
],
},

// Disabled rules:
...{
"prefer-const": "off",
"no-shadow": "off", // Replaced with "@typescript-eslint/no-shadow".
"no-unused-vars": "off", // Replaced with "@typescript-eslint/no-unused-vars".
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/unbound-method": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-unsafe-argument": "off",
"@typescript-eslint/no-empty-object-type": "off",
},

// Rules to be enabled:
...{
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-return": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/restrict-template-expressions": "off",
"@typescript-eslint/no-non-null-asserted-optional-chain": "off",
},

// Rules to be discussed:
...{
"prefer-spread": "off",
"no-async-promise-executor": "off",
"no-case-declarations": "off",
"no-fallthrough": "off",
"no-inner-declarations": "off",
"@typescript-eslint/require-await": "off",
"@typescript-eslint/prefer-regexp-exec": "off",
},
},
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
warnOnUnsupportedTypeScriptVersion: false,
},
},
},
{
files: ["test/**/*.ts"],
rules: {
"@typescript-eslint/no-unused-expressions": "off",
},
}
);
13 changes: 6 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"clean": "ts-node --transpile-only src/index clean",
"coverage-show": "open-cli build/coverage/index.html",
"ci": "ts-node --transpile-only src/index ci --no-format",
"lint": "eslint . --ext .ts"
"lint": "eslint"
},
"author": "johan@johangorter.com",
"license": "MIT",
Expand Down Expand Up @@ -82,17 +82,16 @@
"parser": "typescript"
},
"dependencies": {
"@eslint/js": "9.10.0",
"@types/chai": "4.3.19",
"@types/eslint__js": "8.42.3",
"@types/mocha": "10.0.8",
"@typescript-eslint/eslint-plugin": "7.16.1",
"@typescript-eslint/parser": "7.16.1",
"async": "3.2.6",
"chai": "4.4.1",
"chokidar": "3.6.0",
"eslint": "8.57.0",
"eslint": "9.10.0",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-es": "4.1.0",
"eslint-plugin-unused-imports": "3.2.0",
"eslint-plugin-unused-imports": "4.1.4",
"glob": "8.1.0",
"handlebars": "4.7.8",
"husky": "9.1.6",
Expand All @@ -110,12 +109,12 @@
"tslib": "2.7.0",
"tsutils": "3.21.0",
"typescript": "5.6.2",
"typescript-eslint": "8.6.0",
"ws": "7.5.2",
"yargs": "15.4.1"
},
"devDependencies": {
"@types/async": "3.2.24",
"@types/eslint": "8.56.10",
"@types/glob": "7.2.0",
"@types/inquirer": "6.5.0",
"@types/node": "22.5.5",
Expand Down
Loading

0 comments on commit d97959a

Please sign in to comment.