sindresorhus / eslint-plugin-unicorn

More than 100 powerful ESLint rules

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Override dont work when change only configuration

TheElegantCoding opened this issue · comments

i do not know if this is a default behavior of eslint but i have this rule on this

{
  "unicorn/filename-case": [
   "error",
    {
      "cases":
        {
          "camelCase": false,
          "kebabCase": false,
          "pascalCase": false,
          "snakeCase": true
        }
    }
  ]
}

i want to override this for some files and change the way the configuration to another one like this

{
  "files": ["**/pages/*" ],
  "unicorn/filename-case": [
    "error",
    {
      "cases":
        {
          "camelCase": false,
          "kebabCase": true,
          "pascalCase": false,
          "snakeCase": false
        }
    }
  ]
}

as you can see i set up kebabCase in this configuration but the override doesn't work, I'm using eslint flat config

This is unrelated to the plugin, it's likely a configuration issue. Use print-config to see what eslint sees and maybe ask on their GitHub Discussions if issues arise

https://eslint.org/docs/latest/use/command-line-interface#--print-config

yes that's correct i found the problem was the order you put the rules in the eslint configuration

this is the correct way to put the configuration i put the override on the top

[
  {
    name: 'unicorn',
    plugins:
    {
      unicorn: pluginUnicorn
    },
   .........
  },
  ...unicornOverride
]

this was my mistake

[
  ...unicornOverride,
  {
    name: 'unicorn',
    plugins:
    {
      unicorn: pluginUnicorn
    },
   .........
  }
]