How to exclude file from linting? #413
-
I have a file Based on my older solution with export default withNuxt({
ignores: ['**/_api.ts']
// other config
}) but the file is still being checked and linting issues reported. What do I do wrong? Overriding |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
I also had problems with ignoring. I have a separate package with separate eslint configs. export const companyIgnores = {
// NOTE: no "name" else, it wouldn't work; maybe a bug in ESLint
ignores: ['**/node_modules', '**/public', '**/vendor', '**/dist', '**/.nuxt'],
};
export const configNuxt = [eslintPluginPrettierRecommended, companyEslintRules, companyIgnores]; This works for me. Could you try making entry an array? export default withNuxt([
{
ignores: ['**/_api.ts'],
},
// other config
]); You could also try to prepend the ignores befor the nuxt rules: export default withNuxt(
// ...Custom flat configs append after nuxt's configs
).prepend(
// ...Prepend some flat configs in front
) see https://eslint.nuxt.com/packages/module#config-customizations |
Beta Was this translation helpful? Give feedback.
-
Having the same proble here. My eslint.config.mjs it this: import withNuxt from './.nuxt/eslint.config.mjs'
The file is detected, as I tried removing the "camelcase" line and it reacted, but "ignores" is not working. Thanks to @dsvgl I learnt that you can define config as an array of objects, so I changed it to this:
And now it works. Thanks a lot @dsvgl ! |
Beta Was this translation helpful? Give feedback.
-
Thank you @dsvgl, the trick with an array of objects does to job for me. However, I cannot help myself but to consider it ugly and counter-intuitive. Why is not possible to use just one compact config object? |
Beta Was this translation helpful? Give feedback.
I also had problems with ignoring. I have a separate package with separate eslint configs.
I have a dedicated config for when it should be used inside
withNuxt
(aka the package/app is a nuxt app).This works for me. Could you try making entry an array?
You could also try to prepend the ignores befor the nuxt rules: