Skip to content

Commit 332d1a8

Browse files
committed
Convert eslint to flat config
1 parent ab616aa commit 332d1a8

6 files changed

+36
-25
lines changed

.eslintrc.js

-24
This file was deleted.

.vscode/settings.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"eslint.experimental.useFlatConfig": true
3+
}

eslint.config.mjs

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import noOnlyPlugin from "eslint-plugin-no-only-tests";
2+
import eslint from "@eslint/js";
3+
4+
export default [
5+
eslint.configs.recommended,
6+
{
7+
rules: {
8+
semi: "error",
9+
"prefer-const": "error",
10+
},
11+
},
12+
{
13+
files: ["**/*.js"],
14+
languageOptions: {
15+
globals: {
16+
require: "readonly",
17+
module: "readonly",
18+
},
19+
},
20+
},
21+
// Prevent .only in tests
22+
{
23+
plugins: {
24+
"no-only-tests": noOnlyPlugin,
25+
},
26+
rules: { "no-only-tests/no-only-tests": "error" },
27+
},
28+
];

index.test.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ function format(css) {
1212
}
1313

1414
async function run(input, output, opts, postcssOpts = {}) {
15-
let result = await postcss([plugin(opts)]).process(input, postcssOpts);
15+
const result = await postcss([plugin(opts)]).process(input, postcssOpts);
1616
expect(format(result.css)).toEqual(format(output));
1717
expect(result.warnings()).toHaveLength(0);
1818
}

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"postcss": "^8.3.0"
3030
},
3131
"devDependencies": {
32+
"@eslint/js": "^8.57.0",
3233
"c8": "^7.11.3",
3334
"clean-publish": "^3.4.2",
3435
"eslint": "^8.57.0",

pnpm-lock.yaml

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)