-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.mjs
More file actions
38 lines (35 loc) · 1.04 KB
/
eslint.config.mjs
File metadata and controls
38 lines (35 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { FlatCompat } from '@eslint/eslintrc';
import { fileURLToPath } from 'url';
import js from '@eslint/js';
import globals from 'globals';
const compat = new FlatCompat({
// provide ESLint recommended (and all) legacy configs
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
// resolve paths relative to this config file
baseDirectory: fileURLToPath(import.meta.url)
});
// legacy ESLintRC config in modern format
const legacyConfig = {
root: true,
env: { node: true, es2023: true },
extends: ["eslint:recommended"],
parserOptions: { ecmaVersion: "latest", sourceType: "module" },
rules: {},
overrides: [{ files: ["test/**/*.js"], env: { jest: true } }],
};
export default [
// apply ESLint's built-in recommended rules
...compat.extends('eslint:recommended'),
// pull in all rules from the legacy config
...compat.config(legacyConfig),
// Jest globals override for test files
{
files: ['test/**/*.js'],
languageOptions: {
globals: {
...globals.jest,
},
},
},
];