N
Nuxt2w ago
Yuri

eslint ignore

My esling.config.mjs:
import tailwind from 'eslint-plugin-tailwindcss'
import { defineFlatConfig } from 'eslint-flat-config-utils'
import withNuxt from './.nuxt/eslint.config.mjs'

export default withNuxt(
defineFlatConfig({
ignores: ['./android/**', './ios/**'],
}),
tailwind.configs['flat/recommended'],
)
import tailwind from 'eslint-plugin-tailwindcss'
import { defineFlatConfig } from 'eslint-flat-config-utils'
import withNuxt from './.nuxt/eslint.config.mjs'

export default withNuxt(
defineFlatConfig({
ignores: ['./android/**', './ios/**'],
}),
tailwind.configs['flat/recommended'],
)
But when I start task lint I receive such error: C:\work\shop**android**\app\build\intermediates\assets\debug\native-bridge.js 4:5 error 'nativeBridge' is assigned a value but never used no-unused-vars How can I exclude android & ios folders from linter?
3 Replies
kapa.ai
kapa.ai2w ago
Hi @Yuri. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- To exclude the android and ios folders from ESLint in your Nuxt project, you need to adjust your ESLint configuration. Based on the information provided in the knowledge sources, here are a couple of approaches you can try: 1. Using the ignore option in nuxt.config.ts: You can use the ignore array in your Nuxt configuration to specify patterns of files and directories to ignore. Add the following to your nuxt.config.ts:
export default defineNuxtConfig({
// ... other config
eslint: {
// ... other eslint config
ignore: [
'**/android/**',
'**/ios/**'
]
}
})
export default defineNuxtConfig({
// ... other config
eslint: {
// ... other eslint config
ignore: [
'**/android/**',
'**/ios/**'
]
}
})
This approach is mentioned in the Nuxt Configuration documentation (https://nuxt.com/docs/api/nuxt-config#ignore). 2. Using .nuxtignore file: Alternatively, you can create a .nuxtignore file in your project's root directory and add the following lines:
android/**
ios/**
android/**
ios/**
This method is described in the .nuxtignore documentation (https://nuxt.com/docs/guide/directory-structure/nuxtignore). 3. Adjusting your eslint.config.mjs: If the above methods don't work, you might need to adjust your eslint.config.mjs file. Instead of using ignores in the defineFlatConfig, try using the ignorePatterns option directly in your config:
import tailwind from 'eslint-plugin-tailwindcss'
import { defineFlatConfig } from 'eslint-flat-config-utils'
import withNuxt from './.nuxt/eslint.config.mjs'

export default withNuxt(
{
ignorePatterns: ['**/android/**', '**/ios/**'],
},
tailwind.configs['flat/recommended'],
)
import tailwind from 'eslint-plugin-tailwindcss'
import { defineFlatConfig } from 'eslint-flat-config-utils'
import withNuxt from './.nuxt/eslint.config.mjs'

export default withNuxt(
{
ignorePatterns: ['**/android/**', '**/ios/**'],
},
tailwind.configs['flat/recommended'],
)
This approach is based on the standard ESLint configuration options, which should be compatible with the Nuxt ESLint module. If these solutions don't resolve your issue, you might need to check if there are any other configurations overriding these ignore settings. The Nuxt ESLint module documentation (https://eslint.nuxt.com/packages/module) suggests using the Nuxt DevTools to inspect the resolved ESLint flat config, which could help you identify any conflicting settings. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai2w ago
<@740173469404364872> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
Yuri
YuriOP2w ago
1- Object literal may only specify known properties, and 'ignore' does not exist in type 'Partial<ModuleOptions>'.ts(2353) 2 - not working 3 - incorrect code. I receive error:
Oops! Something went wrong! :(

ESLint: 9.10.0

A config object is using the "ignorePatterns" key, which is not supported in flat config system.

Flat config uses "ignores" to specify files to ignore.
Oops! Something went wrong! :(

ESLint: 9.10.0

A config object is using the "ignorePatterns" key, which is not supported in flat config system.

Flat config uses "ignores" to specify files to ignore.
Correct variant is:
// @ts-check
// @ts-ignore
import tailwind from 'eslint-plugin-tailwindcss'
import withNuxt from './.nuxt/eslint.config.mjs'

export default withNuxt(
{
ignores: ['android/**', 'ios/**'],
},
...tailwind.configs['flat/recommended'],
)
// @ts-check
// @ts-ignore
import tailwind from 'eslint-plugin-tailwindcss'
import withNuxt from './.nuxt/eslint.config.mjs'

export default withNuxt(
{
ignores: ['android/**', 'ios/**'],
},
...tailwind.configs['flat/recommended'],
)
Want results from more Discord servers?
Add your server