Last active
April 8, 2021 18:59
-
-
Save sirlancelot/4f5a5214a74858376c296880a4a23f48 to your computer and use it in GitHub Desktop.
Starter ESLint config
This file contains hidden or 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
const IS_PROD = process.env.NODE_ENV === "production" | |
/** @type {import("prettier").Options} */ | |
const prettierRc = { | |
arrowParens: "always", | |
endOfLine: "lf", | |
quoteProps: "consistent", | |
semi: false, | |
trailingComma: "es5", | |
} | |
/** @type {import("eslint").Linter.BaseConfig} */ | |
module.exports = { | |
root: true, | |
env: { node: true }, | |
extends: ["plugin:vue/recommended", "eslint:recommended", "@vue/prettier"], | |
parserOptions: { | |
parser: "babel-eslint", | |
}, | |
rules: { | |
"complexity": ["warn", { max: 6 }], | |
"max-depth": ["warn", { max: 2 }], | |
"max-nested-callbacks": ["warn", { max: 2 }], | |
"max-params": ["warn", { max: 3 }], | |
"no-console": IS_PROD ? "error" : "off", | |
"no-debugger": IS_PROD ? "error" : "off", | |
"prettier/prettier": ["error", prettierRc], | |
"vue/component-tags-order": "off", | |
"vue/valid-v-slot": "off", // See vuejs/eslint-plugin-vue#1229 | |
}, | |
overrides: [ | |
{ | |
files: [ | |
"**/__tests__/*.{j,t}s?(x)", | |
"tests/unit/setup.js", | |
"tests/unit/**/*.spec.{j,t}s?(x)", | |
], | |
env: { | |
mocha: true, | |
}, | |
rules: { | |
"max-nested-callbacks": "off", | |
"import/no-extraneous-dependencies": "off", | |
}, | |
}, | |
{ | |
files: "src/lang/*.js", | |
excludedFiles: "src/lang/index.js", | |
rules: { | |
"no-irregular-whitespace": "off", | |
"prettier/prettier": ["error", { ...prettierRc, printWidth: 999 }], | |
}, | |
}, | |
], | |
} |
This file contains hidden or 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
{ | |
"editor.codeActionsOnSave": [ | |
"source.fixAll.eslint", | |
], | |
"editor.insertSpaces": true, | |
"editor.renderWhitespace": "boundary", | |
"editor.rulers": [80], | |
"editor.tabSize": 2, | |
"files.eol": "\n", | |
"files.insertFinalNewline": true, | |
"files.trimTrailingWhitespace": true, | |
"javascript.preferences.importModuleSpecifierEnding": "js", | |
"search.exclude": { | |
".nyc_output": true, | |
"coverage": true, | |
"dist": true, | |
}, | |
} |
This file contains hidden or 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
{ | |
"scripts": { | |
"lint": "eslint --fix --ext .js,.vue --ignore-path .gitignore ." | |
}, | |
"devDependencies": { | |
"@vue/cli-plugin-eslint": "3.5.1", | |
"@vue/eslint-config-prettier": "4.0.1", | |
"eslint": "7.20.0", | |
"eslint-plugin-prettier": "3.3.1", | |
"eslint-plugin-vue": "7.6.0", | |
"prettier": "2.2.1", | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment