Skip to content

Commit

Permalink
Convert eslint to flat config
Browse files Browse the repository at this point in the history
  • Loading branch information
IanVS committed Mar 19, 2024
1 parent ab616aa commit 332d1a8
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 25 deletions.
24 changes: 0 additions & 24 deletions .eslintrc.js

This file was deleted.

3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"eslint.experimental.useFlatConfig": true
}
28 changes: 28 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import noOnlyPlugin from "eslint-plugin-no-only-tests";
import eslint from "@eslint/js";

export default [
eslint.configs.recommended,
{
rules: {
semi: "error",
"prefer-const": "error",
},
},
{
files: ["**/*.js"],
languageOptions: {
globals: {
require: "readonly",
module: "readonly",
},
},
},
// Prevent .only in tests
{
plugins: {
"no-only-tests": noOnlyPlugin,
},
rules: { "no-only-tests/no-only-tests": "error" },
},
];
2 changes: 1 addition & 1 deletion index.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function format(css) {
}

async function run(input, output, opts, postcssOpts = {}) {
let result = await postcss([plugin(opts)]).process(input, postcssOpts);
const result = await postcss([plugin(opts)]).process(input, postcssOpts);
expect(format(result.css)).toEqual(format(output));
expect(result.warnings()).toHaveLength(0);
}
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"postcss": "^8.3.0"
},
"devDependencies": {
"@eslint/js": "^8.57.0",
"c8": "^7.11.3",
"clean-publish": "^3.4.2",
"eslint": "^8.57.0",
Expand Down
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

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

0 comments on commit 332d1a8

Please sign in to comment.