Skip to content

Migrate to flat ESLint flat config and remove cross-env #3758

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

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
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
76 changes: 47 additions & 29 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,34 +1,52 @@
import globals from "globals";
import path from "node:path";
import { fileURLToPath } from "node:url";
import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";
import pluginJs from "@eslint/js";
import stylisticJs from "@stylistic/eslint-plugin-js";
import prettier from "eslint-config-prettier";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
});
export const GLOB_SRC_EXT = '?([cm])[jt]s?(x)'

export default [
...compat.extends("eslint:recommended", "prettier"),
{
languageOptions: {
globals: {
...globals.node,
},

ecmaVersion: "latest",
sourceType: "module",
},
export const GLOB_TESTS = [
`**/test/**/*.${GLOB_SRC_EXT}`,
`**/__tests__/**/*.${GLOB_SRC_EXT}`,
`**/*.spec.${GLOB_SRC_EXT}`,
`**/*.test.${GLOB_SRC_EXT}`,
`**/*.bench.${GLOB_SRC_EXT}`,
`**/*.benchmark.${GLOB_SRC_EXT}`,
]

rules: {
"no-async-promise-executor": "warn",
"no-prototype-builtins": "warn",
"no-unused-vars": "warn",
"space-unary-ops": "error",
},
},
export default [
{
name: "11ty/setup/js",
...pluginJs.configs.recommended,
},
{
name: "11ty/rules/project-specific",
plugins: {
"@stylistic/js": stylisticJs,
},
languageOptions: {
globals: {
...globals.node,
},
ecmaVersion: "latest",
sourceType: "module",
},
rules: {
"no-async-promise-executor": "warn",
"no-prototype-builtins": "warn",
"no-unused-vars": "warn",
"@stylistic/js/space-unary-ops": "error",
},
},
{
name: "11ty/ignores",
files: GLOB_TESTS,
rules: {
"no-unused-vars": "off",
},
},
{
name: "11ty/setup/prettier",
...prettier,
},
];
39 changes: 18 additions & 21 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,15 @@
"@11ty/eleventy-img": "^6.0.2",
"@11ty/eleventy-plugin-rss": "^2.0.3",
"@11ty/eleventy-plugin-syntaxhighlight": "^5.0.0",
"@eslint/eslintrc": "^3.3.1",
"@eslint/js": "^9.24.0",
"@iarna/toml": "^2.2.5",
"@mdx-js/node-loader": "^3.1.0",
"@stylistic/eslint-plugin-js": "^4.2.0",
"@types/node": "^22.14.1",
"@vue/server-renderer": "^3.5.13",
"@zachleat/noop": "^1.0.4",
"ava": "^6.2.0",
"c8": "^10.1.3",
"cross-env": "^7.0.3",
"eslint": "^9.24.0",
"eslint-config-prettier": "^10.1.2",
"globals": "^16.0.0",
Expand Down