-
Notifications
You must be signed in to change notification settings - Fork 571
how to configure eslint-plugin-header (version 3.1.1) with new eslint (9.4.0) which has flat config file (eslint.config.mjs) #1976
Description
Reproduction of the problem
- I have installed and configured eslint (9.4.0) which has new flag config system i.e eslint.config.mjs file.
- installed the eslint-plugin-header with latest version (3.1.1)
- configured the header but it is giving below error,
**Oops! Something went wrong! :(
ESLint: 9.4.0
Error: Key "rules": Key "header/header":
Value ["block",["Your Project Header"]] should NOT have more than 0 items.**
below is my eslint.config.mjs file 👎
import globals from 'globals';
import pluginJs from '@eslint/js';
import tseslint from 'typescript-eslint';
import pluginReactConfig from 'eslint-plugin-react/configs/recommended.js';
import { fixupConfigRules } from '@eslint/compat';
import prettierConfig from 'eslint-config-prettier';
import pluginPrettier from 'eslint-plugin-prettier';
import header from 'eslint-plugin-header';
export default [
{ languageOptions: { globals: globals.browser } },
pluginJs.configs.recommended,
...tseslint.configs.recommended,
{
files: ['**/*.{js,jsx,ts,tsx}'],
languageOptions: { parserOptions: { ecmaFeatures: { jsx: true } } },
settings: {
react: {
version: 'detect'
}
},
rules: {
// ESLint core rules
'no-shadow': 'off',
'no-empty': 0,
// TypeScript specific rules
'@typescript-eslint/no-shadow': ['error'],
'no-redeclare': 'off',
'@typescript-eslint/no-redeclare': ['error'],
'comma-dangle': 'off',
'@typescript-eslint/comma-dangle': ['error'],
// Header rules
'header/header': [2, 'block', ['Your Project Header']],
// React specific rules
'react/jsx-uses-react': 'off',
'react/react-in-jsx-scope': 'off'
}
},
...fixupConfigRules(pluginReactConfig),
prettierConfig,
{
plugins: {
prettier: pluginPrettier,
header: header
},
rules: {
'prettier/prettier': 'error',
'header/header': 'error'
}
}
];