Last active
June 7, 2024 08:20
-
-
Save JohnCampionJr/a082f8967dd6341c41d923ad8502e999 to your computer and use it in GitHub Desktop.
ESLint Configuration - Based on @antfu/eslint-config, but with Nuxt and Tailwind
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import antfu from '@antfu/eslint-config' | |
import perfectionistNatural from 'eslint-plugin-perfectionist/configs/recommended-natural' | |
import tailwind from 'eslint-plugin-tailwindcss' | |
import eslintPluginUnicorn from 'eslint-plugin-unicorn' | |
import withNuxt from './.nuxt/eslint.config.mjs' | |
export default withNuxt( | |
antfu( | |
{ formatters: true, stylistic: true }, | |
), | |
{ | |
name: 'unicorn/recommended', | |
rules: eslintPluginUnicorn.configs['flat/recommended'].rules, | |
}, | |
...tailwind.configs['flat/recommended'], | |
{ | |
name: 'jcamp/perfectionist', | |
rules: { | |
'import/order': 'off', // handled by perfectionist | |
'sort-imports': 'off', // handled by perfectionist | |
'perfectionist/sort-imports': perfectionistNatural.rules['perfectionist/sort-imports'], | |
'perfectionist/sort-exports': perfectionistNatural.rules['perfectionist/sort-exports'], | |
'perfectionist/sort-named-imports': perfectionistNatural.rules['perfectionist/sort-named-imports'], | |
'perfectionist/sort-named-exports': perfectionistNatural.rules['perfectionist/sort-named-exports'], | |
}, | |
}, | |
{ | |
name: 'jcamp/tailwind', | |
rules: { | |
'tailwindcss/no-custom-classname': 'off', | |
}, | |
}, | |
{ | |
name: 'jcamp/vue', | |
rules: { | |
'vue/max-attributes-per-line': ['error', { | |
singleline: 3, | |
multiline: 1, | |
}], | |
}, | |
}, | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default defineNuxtConfig({ | |
modules: ['@nuxt/eslint'], | |
eslint: { | |
config: { | |
standalone: false, | |
}, | |
}, | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"devDependencies": { | |
"@antfu/eslint-config": "^2.20.0", | |
"@nuxt/eslint": "^0.3.13", | |
"eslint": "9.4.0", | |
"eslint-plugin-format": "^0.1.1", | |
"eslint-plugin-tailwindcss": "3.17.3", | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
// Enable the ESlint flat config support | |
// (remove this if your ESLint extension above v3.0.5) | |
"eslint.useFlatConfig": true, | |
// Disable the default formatter, use eslint instead | |
"prettier.enable": false, | |
"editor.formatOnSave": false, | |
// Auto fix | |
"editor.codeActionsOnSave": { | |
"source.fixAll.eslint": "explicit", | |
"source.organizeImports": "never" | |
}, | |
// Silent the stylistic rules in you IDE, but still auto fix them | |
"eslint.rules.customizations": [ | |
{ "rule": "style/*", "severity": "off" }, | |
{ "rule": "format/*", "severity": "off" }, | |
{ "rule": "*-indent", "severity": "off" }, | |
{ "rule": "*-spacing", "severity": "off" }, | |
{ "rule": "*-spaces", "severity": "off" }, | |
{ "rule": "*-order", "severity": "off" }, | |
{ "rule": "*-dangle", "severity": "off" }, | |
{ "rule": "*-newline", "severity": "off" }, | |
{ "rule": "*quotes", "severity": "off" }, | |
{ "rule": "*semi", "severity": "off" } | |
], | |
// Enable eslint for all supported languages | |
"eslint.validate": [ | |
"javascript", | |
"javascriptreact", | |
"typescript", | |
"typescriptreact", | |
"vue", | |
"html", | |
"markdown", | |
"json", | |
"jsonc", | |
"yaml", | |
"toml", | |
"xml", | |
"gql", | |
"graphql", | |
"astro", | |
"css", | |
"less", | |
"scss", | |
"pcss", | |
"postcss" | |
], | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment