Package | Description | Latest |
---|---|---|
@cdlab996/eslint-config-ts | 🔨 Eslint TypeScript | |
@cdlab996/eslint-config-next | 🔨 Eslint Nextjs | |
@cdlab996/eslint-config-react | 🔨 Eslint React | |
@cdlab996/eslint-config-vue | 🔨 Eslint Vue | |
@cdlab996/eslint-config-vue2 | 🔨 Eslint Vue2 | |
@cdlab996/prettier-config | 🔨 prettier |
# @cdlab996/eslint-config-vue
pnpm add -D @cdlab996/eslint-config eslint@8.57.0
pnpm add -D @cdlab996/prettier-config prettier
// .eslintrc.js/cjs
// Only use if you want a stricter ruleset
process.env.ESLINT_TSCONFIG = 'tsconfig.json'
module.exports = {
extends: '@cdlab996',
}
To configure Prettier, create a .prettierrc.js
file in the root of your project and add the following content:
// .prettierrc.js/cjs
module.exports = {
...require('@cdlab996/prettier-config'),
// Add your custom configurations here
}
To enable automatic code formatting with ESLint in Visual Studio Code, add the following settings to your workspace or user settings:
// .vscode/settings.json
{
// Disable the default formatter, use eslint instead
"editor.formatOnSave": false,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"prettier.enable": true,
"css.validate": false,
"less.validate": false,
"scss.validate": false,
// Auto fix
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit",
"source.fixAll.stylelint": "explicit",
"source.organizeImports": "never"
},
// Enable eslint for all supported languages
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
"vue",
"html",
"markdown",
"json",
"jsonc",
"yaml",
"toml"
],
"stylelint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
"vue",
"html",
"markdown",
"json",
"jsonc",
"yaml",
"toml"
]
}
This project is inspired by: