Skip to content

Commit

Permalink
feat: 优化插件代码eslint (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
liangling0628 authored May 14, 2024
1 parent f2d67a2 commit 8ac9be8
Show file tree
Hide file tree
Showing 77 changed files with 3,354 additions and 3,131 deletions.
7 changes: 0 additions & 7 deletions .eslintignore

This file was deleted.

37 changes: 9 additions & 28 deletions .stylelintrc.js
Original file line number Diff line number Diff line change
@@ -1,50 +1,31 @@
const path = require('path');
module.exports = {
extends: ['stylelint-config-recess-order'],
overrides: [
{
files: ['./src/**/*.scss'],
plugins: ['stylelint-scss', 'stylelint-order'],
rules: {
'scss/at-extend-no-missing-placeholder': true,
'scss/dollar-variable-pattern': '^_?[a-z]+[\\w-]*$',
},
customSyntax: 'postcss-scss',
files: ['src/**/*.scss', 'src/**/*.css'],
},
{
customSyntax: 'postcss-less',
files: ['src/**/*.less'],
},
],
plugins: ['stylelint-scss', 'stylelint-order'],
rules: {
'at-rule-empty-line-before': [
'always',
{
except: ['first-nested', 'blockless-after-blockless'],
ignore: ['after-comment'],
},
],
'at-rule-no-unknown': [
true,
{
ignoreAtRules: ['/.*/'],
},
],
'at-rule-no-vendor-prefix': true,
'block-opening-brace-space-before': 'always',
// 颜色值要小写
'color-hex-case': 'lower',
// 颜色值能短则短
'color-hex-length': 'short',
'comment-empty-line-before': ['always', { except: ['first-nested'] }],
'declaration-block-single-line-max-declarations': 1,
'declaration-colon-space-after': 'always',
'declaration-colon-space-before': 'never',
// 不能用important
'declaration-no-important': true,
// Base rules
indentation: 2,
// Sass rules
'max-nesting-depth': 10,
// 不要使用已被 autoprefixer 支持的浏览器前缀
'media-feature-name-no-vendor-prefix': true,

'number-leading-zero': 'never',
'order/order': ['declarations', { type: 'at-rule' }, { hasBlock: true, type: 'at-rule' }, 'rules'],
'property-no-vendor-prefix': true,
// 去掉多个import、extends、父子声明之间的空行 --开始
Expand All @@ -55,10 +36,10 @@ module.exports = {
ignore: ['after-comment'],
},
],
'selector-list-comma-newline-after': 'always',
'scss/at-extend-no-missing-placeholder': true,
'scss/dollar-variable-pattern': '^_?[a-z]+[\\w-]*$',
'selector-max-id': 3,
'selector-no-vendor-prefix': true,
'string-quotes': 'single',
'value-no-vendor-prefix': true,
},
};
Loading

0 comments on commit 8ac9be8

Please sign in to comment.