Skip to content

Commit

Permalink
Switch to Eslint >=9
Browse files Browse the repository at this point in the history
  • Loading branch information
BarnabyShearer committed Aug 8, 2024
1 parent 7b9795c commit aaeb0ae
Show file tree
Hide file tree
Showing 4 changed files with 333 additions and 476 deletions.
104 changes: 52 additions & 52 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,56 +1,56 @@
module.exports = {
extends: [
"prettier",
"eslint:recommended",
"plugin:n/recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"plugin:deprecation/recommended",
],
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: 2021,
sourceType: "module",
project: ["./tsconfig.json"],
import typescriptEslint from "typescript-eslint";
import vitest from "eslint-plugin-vitest";
import nodePlugin from "eslint-plugin-n";
import deprecationPlugin from "eslint-plugin-deprecation";
import js from "@eslint/js";
import { fixupPluginRules, fixupConfigRules } from "@eslint/compat";
import eslintConfigPrettier from "eslint-config-prettier";

export default [
js.configs.recommended,
...typescriptEslint.configs.recommended,
...typescriptEslint.configs.recommendedTypeChecked,
nodePlugin.configs["flat/recommended-module"],
...fixupConfigRules({
...deprecationPlugin.configs.recommended,
plugins: { ["deprecation"]: fixupPluginRules(deprecationPlugin) },
}),
{
ignores: ["dist", ".wrangler", "**/api.d.ts", "**/*-definitions.ts"],
},
plugins: ["prettier", "@typescript-eslint", "filenames"],
ignorePatterns: ["api.d.ts", "*-definitions.ts"],
rules: {
"n/no-unpublished-import": "off",
"n/no-missing-import": "off",
"n/no-unsupported-features/node-builtins": "off",
eqeqeq: ["error"],
"@typescript-eslint/no-shadow": 2,
semi: ["error", "always"],
"prettier/prettier": [
"error",
{
endOfLine: "auto",
{
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
],
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/switch-exhaustiveness-check": "error",
"@typescript-eslint/unbound-method": "off",
"filenames/match-regex": [2, "^[a-z][a-z0-9.-]*$"],
"filenames/match-exported": [2, "kebab"],
},
rules: {
"n/no-unpublished-import": "off",
"n/no-missing-import": "off",
"n/no-unsupported-features/node-builtins": "off",
eqeqeq: ["error"],
"@typescript-eslint/no-shadow": 2,
semi: ["error", "always"],
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/switch-exhaustiveness-check": "error",
"@typescript-eslint/unbound-method": "off",
},
},
overrides: [
{
files: ["**/*.test.ts", "**/*.test.tsx", "./src/__tests__/**/*.ts"],
plugins: ["vitest"],
extends: ["plugin:vitest/recommended"],
rules: {
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/ban-ts-comment": "off",
"vitest/no-export": "off",
"vitest/expect-expect": "off",
"vitest/no-conditional-expect": "off",
},
{
files: ["**/*.test.ts", "**/*.test.tsx", "./src/__tests__/**/*.ts"],
...vitest.configs.recommended,
rules: {
...vitest.configs.recommended.rules,
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/ban-ts-comment": "off",
"vitest/no-export": "off",
"vitest/expect-expect": "off",
"vitest/no-conditional-expect": "off",
},
],
root: true,
};
},
eslintConfigPrettier,
];
27 changes: 17 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,32 @@
"name": "eslint-config-two-stroke",
"description": "eslint settings for two-stroke.",
"license": "MIT",
"version": "1.0.10",
"version": "1.1.0",
"main": "index.js",
"dependencies": {
"@typescript-eslint/eslint-plugin": "^7.13.0",
"@typescript-eslint/parser": "^7.13.0",
"@eslint/compat": "^1.1.1",
"@typescript-eslint/eslint-plugin": "^8.0.1",
"@typescript-eslint/parser": "^8.0.1",
"eslint-config-prettier": "^9.1.0",
"eslint-config-typescript": "^3.0.0",
"eslint-plugin-deprecation": "^3.0.0",
"eslint-plugin-filenames": "^1.3.2",
"eslint-plugin-n": "^17.9.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-vitest": "^0.5.4"
"eslint-plugin-n": "^17.10.2",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-vitest": "^0.5.4",
"typescript-eslint": "^8.0.1"
},
"packageManager": "yarn@4.3.0",
"prettier": {
"printWidth": 80
},
"devDependencies": {
"eslint": "^8.57.0",
"typescript": "^5.4.5"
}
"eslint": "^9.8.0",
"prettier": "^3.3.3",
"typescript": "^5.5.4"
},
"peerDependencies": {
"eslint": "^9.8.0",
"prettier": ">=3"
},
"type": "module"
}
16 changes: 16 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"compilerOptions": {
"allowJs": true,
"esModuleInterop": true,
"isolatedModules": true,
"lib": ["ESNext"],
"module": "ESNext",
"moduleResolution": "bundler",
"noUncheckedIndexedAccess": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"strict": true,
"target": "ESNext",
"types": ["@cloudflare/workers-types", "vitest/globals"]
}
}
Loading

0 comments on commit aaeb0ae

Please sign in to comment.