Skip to content

Instantly share code, notes, and snippets.

@randercarlos
Last active October 25, 2024 18:01
Show Gist options
  • Save randercarlos/f892fdc1de17c22670f3d805eda5fef2 to your computer and use it in GitHub Desktop.
Save randercarlos/f892fdc1de17c22670f3d805eda5fef2 to your computer and use it in GitHub Desktop.
install on new Nuxt project
pnpm dlx nuxi module add eslint
pnpm dlx nuxi module add tailwindcss
pnpm dlx nuxi module add google-fonts
pnpm add -D vue-tsc typescript vite-plugin-eslint2
package.json
"scripts": {
"lint:check": "eslint .",
"lint:fix": "eslint . --fix"
},
eslint.config.mjs
import withNuxt from './.nuxt/eslint.config.mjs';
import withNuxt from './.nuxt/eslint.config.mjs';
export default withNuxt({
rules: {
// 'no-console': 'error',
// 'no-alert': 'error',
// no-debugger,
'@stylistic/indent': ['error', 2],
'@stylistic/quotes': ['error', 'single'],
'@stylistic/semi': ['error', 'always'],
'@stylistic/brace-style': ['error', '1tbs'],
'@stylistic/comma-dangle': ['error', 'never'],
'@stylistic/max-len': ['error', {
code: 100,
ignoreStrings: true,
ignoreUrls: true
}],
'@stylistic/member-delimiter-style': ['error', {
multiline: {
delimiter: 'semi', // O delimitador será um ponto e vírgula (;)
requireLast: true // Exige um delimitador na última linha
},
singleline: {
delimiter: 'semi', // Para uma linha, também será ponto e vírgula (;)
requireLast: true // Não é necessário um delimitador na última linha para singleline
}
}],
'vue/no-multiple-template-root': 'off',
'vue/html-self-closing': 'off',
'vue/component-name-in-template-casing': ['error', 'PascalCase', {
registeredComponentsOnly: false
}],
'vue/first-attribute-linebreak': ['error', {
singleline: 'beside',
multiline: 'below'
}]
// 'vue/max-attributes-per-line': ['error', {
// singleline: {
// max: 4,
// },
// multiline: {
// max: 4,
// },
// }],
}
});
nuxt.config.tsc
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
compatibilityDate: '2024-04-03',
devtools: { enabled: true },
modules: ['@nuxtjs/tailwindcss', '@nuxtjs/google-fonts', '@nuxt/eslint'],
eslint: {
checker: true,
config: {
stylistic: {
indent: 2,
quotes: 'single',
semi: true,
},
},
},
typescript: {
typeCheck: true,
},
googleFonts: {
display: 'swap', // Use 'swap' para melhorar o carregamento da fonte
families: {
Inter: [100, 300, 400, 700, 900],
},
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment