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