Difference between revisions of "User:Saul/eslint"
From Organic Design wiki
(Created page and added info.) |
(Added dependencies.) |
||
Line 2: | Line 2: | ||
There is a package for the text editor atom (atom.io) that intergrates linting, the package is called: "linter-eslint"<br> | There is a package for the text editor atom (atom.io) that intergrates linting, the package is called: "linter-eslint"<br> | ||
The linting config file is stored as ".eslintrc.js"<br> | The linting config file is stored as ".eslintrc.js"<br> | ||
+ | Here are the dependencies needed for linting vue: | ||
+ | <source lang="bash"> | ||
+ | npm i -D babel-eslint eslint eslint-config-standard eslint-plugin-html eslint-plugin-import eslint-plugin-node eslint-plugin-promise eslint-plugin-standard | ||
+ | </source> | ||
Here is the rule set I like to use: | Here is the rule set I like to use: | ||
<source lang="javascript"> | <source lang="javascript"> |
Revision as of 23:45, 11 July 2018
Linting is a way to ensure your code follows convention.
There is a package for the text editor atom (atom.io) that intergrates linting, the package is called: "linter-eslint"
The linting config file is stored as ".eslintrc.js"
Here are the dependencies needed for linting vue:
npm i -D babel-eslint eslint eslint-config-standard eslint-plugin-html eslint-plugin-import eslint-plugin-node eslint-plugin-promise eslint-plugin-standard
Here is the rule set I like to use:
module.exports = {
root: true,
parser: 'babel-eslint',
parserOptions: {
sourceType: 'module'
},
env: {
browser: true,
},
// https://github.com/standard/standard/blob/master/docs/RULES-en.md
extends: 'standard',
// required to lint *.vue files
plugins: [
'html'
],
'rules': {
// disallow single quotes
"quotes": ["error", "double"],
// force semi-colons
"semi": ["error", "always"],
// allow tabs
"no-tabs": [0],
// use tab indentation
"indent": ["error", "tab"],
// allow paren-less arrow functions
'arrow-parens': 0,
// allow async-await
'generator-star-spacing': 0,
// allow debugger during development
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0
}
}