Skip to content

Commit

Permalink
Merge pull request #230 from Codex-/renovate/major-eslint-monorepo
Browse files Browse the repository at this point in the history
chore(deps): update dependency eslint to v9
  • Loading branch information
Codex- authored Aug 14, 2024
2 parents 42b8ad1 + 13ef8f9 commit 0c77d72
Show file tree
Hide file tree
Showing 11 changed files with 577 additions and 384 deletions.
61 changes: 0 additions & 61 deletions .eslintrc.json

This file was deleted.

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

import { fixupPluginRules } from "@eslint/compat";
import jsEslint from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";
import eslintConfigPrettier from "eslint-config-prettier";
import tsEslint from "typescript-eslint";

const compat = new FlatCompat({
baseDirectory: import.meta.dirname,
recommendedConfig: jsEslint.configs.recommended,
allConfig: jsEslint.configs.all,
});

/* eslint-disable @typescript-eslint/explicit-function-return-type */
/**
* @param {string} name the pugin name
* @param {string} alias the plugin alias
* @returns {import("eslint").ESLint.Plugin}
*/
function legacyPlugin(name, alias = name) {
const plugin = compat.plugins(name)[0]?.plugins?.[alias];

if (!plugin) {
throw new Error(`Unable to resolve plugin ${name} and/or alias ${alias}`);
}

return fixupPluginRules(plugin);
}
/* eslint-enable @typescript-eslint/explicit-function-return-type */

export default tsEslint.config(
jsEslint.configs.recommended,
...tsEslint.configs.strictTypeChecked,
...tsEslint.configs.stylisticTypeChecked,
{
languageOptions: {
parserOptions: {
projectService: {
allowDefaultProject: ["*.js", "*.mjs"],
},
tsconfigRootDir: import.meta.dirname,
},
},
},
{
ignores: [
"**/coverage",
"**/dist",
"**/esbuild.config.mjs",
"**/vitest.config.ts",
],
},
{
plugins: {
github: legacyPlugin("eslint-plugin-github", "github"), // pending https://github.com/github/eslint-plugin-github/issues/513
import: legacyPlugin("eslint-plugin-import", "import"),
},
rules: {
"@typescript-eslint/await-thenable": "warn",
"@typescript-eslint/explicit-function-return-type": "warn",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-floating-promises": [
"warn",
{ ignoreIIFE: true, ignoreVoid: false },
],
"@typescript-eslint/no-shadow": "error",
"@typescript-eslint/no-unused-vars": [
"warn",
{ argsIgnorePattern: "^_" },
],
"@typescript-eslint/restrict-template-expressions": [
"error",
{
allowNever: true,
allowNumber: true,
},
],
"github/array-foreach": "error",
"github/no-implicit-buggy-globals": "error",
"github/no-then": "error",
"github/no-dynamic-script-tag": "error",
"import/no-extraneous-dependencies": [
"error",
{
devDependencies: true,
optionalDependencies: true,
peerDependencies: true,
},
],
"import/order": "warn",
"no-console": ["warn"],
},
},
{
files: ["**/*.spec.ts"],
rules: {
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
},
},
{
files: ["**/*.js", "**/*.mjs"],
...tsEslint.configs.disableTypeChecked,
},
eslintConfigPrettier,
);
17 changes: 11 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"build:types": "tsc",
"format:check": "prettier --check **/*.ts",
"format": "pnpm run format:check --write",
"lint": "eslint --ext \".js,.ts\" .",
"lint": "eslint",
"lint:fix": "pnpm run lint --fix",
"release": "release-it",
"test": "vitest",
Expand All @@ -34,21 +34,26 @@
"uuid": "^10.0.0"
},
"devDependencies": {
"@types/node": "^20.14.13",
"@eslint/compat": "^1.1.1",
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.9.0",
"@total-typescript/ts-reset": "^0.5.1",
"@types/eslint__js": "^8.42.3",
"@types/node": "^22.2.0",
"@types/uuid": "^10.0.0",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0",
"@typescript-eslint/eslint-plugin": "^8.1.0",
"@typescript-eslint/parser": "^8.1.0",
"@vitest/coverage-v8": "^2.0.5",
"chalk": "^5.3.0",
"changelogithub": "^0.13.9",
"esbuild": "^0.23.0",
"eslint": "^8.57.0",
"eslint-config-airbnb-typescript": "^18.0.0",
"eslint": "^9.9.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-github": "^5.0.1",
"eslint-plugin-import": "^2.29.1",
"prettier": "3.3.3",
"typescript": "^5.5.4",
"typescript-eslint": "^8.1.0",
"vitest": "^2.0.5"
}
}
Loading

0 comments on commit 0c77d72

Please sign in to comment.