Skip to content

Commit

Permalink
style: add eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
xiazeyu committed Feb 19, 2018
1 parent 74a4087 commit 4aa5325
Show file tree
Hide file tree
Showing 2 changed files with 213 additions and 2 deletions.
207 changes: 207 additions & 0 deletions .eslintrc.js
@@ -0,0 +1,207 @@
module.exports = {
'env': {
'browser': true,
'commonjs': true,
'es6': true
},
// 'extends': 'eslint:all',
'extends': 'eslint:recommended',
'parserOptions': {
'sourceType': 'script'
},
'rules': {
'indent': [
'error',
2
],
'linebreak-style': [
'error',
'unix',
],
'quotes': [
'error',
'single',
],
'semi': [
'error',
'always',
],
'no-console': 'off',
'no-extra-parens': [
'error',
],
'valid-jsdoc': [
'warn',
],
'array-callback-return': [
'error',
],
'block-scoped-var': [
'warn',
],
'consistent-return': [
'error',
{
'treatUndefinedAsUnspecified': true,
}
],
'curly': [
'warn',
'all',
],
'default-case': [
'error',
],
'dot-location': [
'error',
'property',
],
'dot-notation': [
'warn',
],
'eqeqeq': [
'error',
],
'no-else-return': [
'error',
],
'no-empty-function': [
'error',
],
'no-magic-numbers': [
'warn',
],
'no-multi-spaces': [
'warn',
],
'no-return-assign': [
'error',
],
'no-sequences': [
'warn',
],
'no-useless-concat': [
'error',
],
'no-useless-return': [
'warn',
],
'strict': [
'error',
],
'no-catch-shadow': [
'error',
],
'no-shadow': [
'error',
],
'no-use-before-define': [
'error',
],
'global-require': [
'error',
],
'array-bracket-newline': [
'warn',
],
'array-bracket-spacing': [
'error',
],
'block-spacing': [
'error',
],
'brace-style': [
'error',
],
'camelcase': [
'error',
],
'comma-dangle': [
'error',
'always',
],
'capitalized-comments': [
'warn',
],
'comma-spacing': [
'warn',
],
'comma-style': [
'warn',
],
'eol-last': [
'warn',
],
'func-names': [
'error',
],
'new-parens': [
'error',
],
'no-lonely-if': [
'error',
],
'no-mixed-operators': [
'error',
],
'no-trailing-spaces': [
'error',
],
'no-unneeded-ternary': [
'error',
],
'one-var': [
'error',
'never',
],
'space-before-function-paren': [
'error'
],
'space-before-blocks': [
'error',
],
'space-in-parens': [
'error',
],
'arrow-body-style': [
'error',
],
'arrow-parens': [
'error',
],
'arrow-spacing': [
'error',
],
'no-var': [
'error',
],
'prefer-const': [
'error',
],
'prefer-template': [
'error',
],
'space-infix-ops': [
'error',
],
'space-unary-ops': [
'error',
],
'spaced-comment': [
'error',
],
'quote-props': [
'error',
],
'require-jsdoc': [
'error',
],
'func-style': [
'warn',
'declaration',
],
'padded-blocks': [
'warn',
],
},
};
8 changes: 6 additions & 2 deletions package.json
Expand Up @@ -31,7 +31,11 @@
"url": "git+ssh://git@github.com/MikeCoder/hexo-blog-encrypt.git"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "echo \"Error: no test specified\" && exit 1",
"lint": "eslint --ext .js ./"
},
"version": "2.0.3"
"version": "2.0.3",
"devDependencies": {
"eslint": "^4.18.0"
}
}

0 comments on commit 4aa5325

Please sign in to comment.