chore: 调整eslint和stylelint配置
This commit is contained in:
parent
6ce23b0e01
commit
45e03fefd4
37
.eslintrc.js
37
.eslintrc.js
|
@ -1,3 +1,7 @@
|
|||
// https://eslint.org/docs/rules/
|
||||
|
||||
const isProduction = process.env.NODE_ENV === 'production'
|
||||
|
||||
module.exports = {
|
||||
root: true,
|
||||
env: {
|
||||
|
@ -13,6 +17,11 @@ module.exports = {
|
|||
},
|
||||
rules: {
|
||||
'curly': ['error', 'multi-line'],
|
||||
'eqeqeq': ['error', 'always'],
|
||||
'semi': ['error', 'never'],
|
||||
'indent': ['error', 2, {
|
||||
'SwitchCase': 1,
|
||||
}],
|
||||
'quotes': ['error', 'single', {
|
||||
'avoidEscape': true,
|
||||
'allowTemplateLiterals': true,
|
||||
|
@ -30,23 +39,20 @@ module.exports = {
|
|||
'spaced-comment': ['error', 'always'],
|
||||
'arrow-spacing': 'error',
|
||||
'no-duplicate-imports': 'error',
|
||||
'semi': ['error', 'never'],
|
||||
'comma-spacing': ['error', { 'before': false, 'after': true }],
|
||||
'indent': ['error', 2, {'SwitchCase': 1}],
|
||||
'eqeqeq': ['error', 'always', {'null': 'ignore'}],
|
||||
'comma-spacing': ['error', {
|
||||
'before': false,
|
||||
'after': true,
|
||||
}],
|
||||
'default-case': 'error',
|
||||
'no-eval': 'error',
|
||||
'no-var': 'error',
|
||||
'no-with': 'error',
|
||||
'max-depth': ['error', 5],
|
||||
'consistent-this': ['error', 'self'],
|
||||
'max-lines': ['error', 1000],
|
||||
'consistent-this': ['error', '_this'],
|
||||
'max-depth': ['error', 4],
|
||||
'max-lines': ['error', 800],
|
||||
'no-multi-str': 'error',
|
||||
'space-infix-ops': 'error',
|
||||
'space-before-blocks': ['error', 'always'],
|
||||
'space-before-function-paren': ['error', {
|
||||
'anonymous': 'never',
|
||||
'named': 'never',
|
||||
'anonymous': 'never',
|
||||
'asyncArrow': 'always',
|
||||
}],
|
||||
'keyword-spacing': ['error'],
|
||||
|
@ -54,9 +60,12 @@ module.exports = {
|
|||
'no-useless-return': 'error',
|
||||
'array-bracket-spacing': 'error',
|
||||
'no-useless-escape': 'off',
|
||||
'no-alert': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
|
||||
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
|
||||
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
|
||||
'no-eval': 'error',
|
||||
'no-var': 'error',
|
||||
'no-with': 'error',
|
||||
'no-alert': isProduction ? 'warn' : 'off',
|
||||
'no-console': isProduction ? 'warn' : 'off',
|
||||
'no-debugger': isProduction ? 'warn' : 'off',
|
||||
},
|
||||
overrides: [
|
||||
{
|
||||
|
|
|
@ -1,33 +1,35 @@
|
|||
// https://stylelint.io/user-guide/rules/list
|
||||
|
||||
module.exports = {
|
||||
extends: 'stylelint-config-standard',
|
||||
rules: {
|
||||
'at-rule-empty-line-before': null,
|
||||
'rule-empty-line-before': null,
|
||||
'no-missing-end-of-source-newline': null,
|
||||
'selector-list-comma-newline-after': null,
|
||||
'font-family-no-missing-generic-family-keyword': null,
|
||||
'no-descending-specificity': null,
|
||||
'number-leading-zero': null,
|
||||
'at-rule-no-unknown': null,
|
||||
'indentation': 2,
|
||||
'max-nesting-depth': 4,
|
||||
'max-empty-lines': null,
|
||||
'selector-pseudo-element-no-unknown': null,
|
||||
'no-eol-whitespace': true,
|
||||
'no-missing-end-of-source-newline': null,
|
||||
'no-descending-specificity': null,
|
||||
'at-rule-empty-line-before': null,
|
||||
'at-rule-no-unknown': null,
|
||||
'rule-empty-line-before': null,
|
||||
'number-leading-zero': null,
|
||||
'string-no-newline': true,
|
||||
'string-quotes': 'single',
|
||||
'color-hex-case': 'lower',
|
||||
'color-hex-length': 'short',
|
||||
'color-no-invalid-hex': true,
|
||||
'font-weight-notation': 'numeric',
|
||||
'font-family-no-missing-generic-family-keyword': null,
|
||||
'function-calc-no-unspaced-operator': true,
|
||||
'function-url-quotes': 'never',
|
||||
'string-no-newline': true,
|
||||
'string-quotes': 'single',
|
||||
'block-no-empty': true,
|
||||
'block-opening-brace-newline-after': 'always',
|
||||
'block-opening-brace-space-before': 'always',
|
||||
'indentation': 2,
|
||||
'max-nesting-depth': 5,
|
||||
'no-eol-whitespace': true,
|
||||
'declaration-block-no-duplicate-properties': true,
|
||||
'declaration-block-semicolon-newline-after': 'always',
|
||||
'declaration-block-trailing-semicolon': 'always',
|
||||
'selector-pseudo-element-colon-notation': 'double',
|
||||
'selector-pseudo-element-no-unknown': null,
|
||||
'selector-list-comma-newline-after': null,
|
||||
},
|
||||
}
|
Loading…
Reference in New Issue