Skip to content

WuChenDi/eslint-config-monorepo

Repository files navigation

⚙️ eslint-config-monorepo

📦 Packages

Package Description Latest
@cdlab996/eslint-config-ts 🔨 Eslint TypeScript npm version
@cdlab996/eslint-config-next 🔨 Eslint Nextjs npm version
@cdlab996/eslint-config-react 🔨 Eslint React npm version
@cdlab996/eslint-config-vue 🔨 Eslint Vue npm version
@cdlab996/eslint-config-vue2 🔨 Eslint Vue2 npm version
@cdlab996/prettier-config 🔨 prettier npm version

🔧 Installation

# @cdlab996/eslint-config-vue

pnpm add -D @cdlab996/eslint-config eslint@8.57.0

pnpm add -D @cdlab996/prettier-config prettier

🎨 ESLint

// .eslintrc.js/cjs

// Only use if you want a stricter ruleset
process.env.ESLINT_TSCONFIG = 'tsconfig.json'

module.exports = {
  extends: '@cdlab996',
}

🎨 Prettier

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
}

⚙️ IDE Settings

Visual Studio Code

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"
  ]
}

⚡ Credits

This project is inspired by:

📜 License

MIT License © 2023-PRESENT wudi