eslint-plugin-valkyriecoms/configs/recommended.js

36 lines
1,019 B
JavaScript
Raw Normal View History

2024-10-02 11:01:50 +00:00
import path from 'node:path';
import { fileURLToPath } from 'node:url';
2024-10-02 11:28:21 +00:00
import { fixupConfigRules } from '@eslint/compat';
2024-10-02 11:01:50 +00:00
import { FlatCompat } from '@eslint/eslintrc';
import js from '@eslint/js';
2024-10-02 11:28:21 +00:00
import javascript from './javascript.js';
import typescript from './typescript.js';
2024-10-02 11:01:50 +00:00
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
2024-10-02 11:14:11 +00:00
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
2024-10-02 11:01:50 +00:00
});
export default [
2024-10-02 11:14:11 +00:00
...fixupConfigRules(compat.extends(
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
// TODO: When enabled, when you import in a .ts file
// parserPath or languageOptions.parser is required!
// This will appear, so disable the following:
// 'plugin:import/recommended',
'plugin:import/typescript',
)),
{
files: ['**/*.js', '**/*.cjs', '**/*.mjs', '**/*.jsx'],
2024-10-02 11:28:21 +00:00
...javascript,
2024-10-02 11:14:11 +00:00
},
{
files: ['**/*.ts', '**/*.tsx'],
2024-10-02 11:28:21 +00:00
...typescript,
2024-10-02 11:14:11 +00:00
},
];