Stylelint

coderljw 2024-10-13 Lint
  • Lint
  • Stylelint
小于 1 分钟

# 1. .stylelintrc.js

/**
 * @link https://stylelint.io
 * @type {import('stylelint').Config}
 */
module.exports = {
  plugins: ['stylelint-declaration-block-no-ignored-properties'],
  rules: {
    'plugin/declaration-block-no-ignored-properties': true,
    'value-no-vendor-prefix': null,
  },
  overrides: [
    {
      files: ['**/*.css'],
      extends: ['stylelint-config-standard', 'stylelint-config-recess-order'],
    },
    {
      files: ['**/*.scss'],
      customSyntax: 'postcss-scss',
      extends: [
        'stylelint-config-standard-scss',
        'stylelint-config-css-modules',
        'stylelint-config-recess-order',
      ],
    },
    {
      files: ['**/*.less'],
      customSyntax: 'postcss-less',
      extends: [
        'stylelint-config-standard',
        'stylelint-config-css-modules',
        'stylelint-config-recess-order',
      ],
      rules: {
        'at-rule-no-unknown': null,
      },
    },
    {
      files: ['**/*.styl', '**/*.stylus'],
      customSyntax: 'postcss-styl',
      extends: [
        'stylelint-config-standard',
        'stylelint-config-css-modules',
        'stylelint-config-recess-order',
      ],
    },
    {
      files: ['**/*.html', '**/*.svelte', '**/*.astro'],
      customSyntax: 'postcss-html',
      extends: [
        'stylelint-config-standard',
        'stylelint-config-html',
        'stylelint-config-recess-order',
      ],
    },
    {
      files: ['**/*.vue'],
      customSyntax: 'postcss-html',
      extends: [
        'stylelint-config-standard',
        'stylelint-config-recommended-vue',
        'stylelint-config-recess-order',
      ],
    },
    {
      files: [
        '**/*.js',
        '**/*.cjs',
        '**/*.mjs',
        '**/*.jsx',
        '**/*.ts',
        '**/*.cts',
        '**/*.mts',
        '**/*.tsx',
      ],
      customSyntax: 'postcss-styled-syntax',
      extends: ['stylelint-config-standard'],
    },
  ],
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79

# 2. .stylelintignore

# https://stylelint.io/user-guide/ignore-code
temp
dist
build

1
2
3
4
5
以父之名
周杰伦.mp3