Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
vishranti5 opened this issue Jun 18, 2024 · 1 comment

Comments

@vishranti5
Copy link

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'
}
}
];

@Bryant-Curtis
Copy link

vishranti5 I'm running into this same issue.

There is a fix for this in progress in the eslint-plugin-header repo FYI
Stuk/eslint-plugin-header#57

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants