@d-zero/stylelint-config 5.0.0-alpha.7 → 5.0.0-alpha.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/base.js CHANGED
@@ -1,34 +1,6 @@
1
1
  module.exports = {
2
- extends: ['stylelint-config-standard', 'stylelint-config-recess-order'],
3
- plugins: ['stylelint-scss', 'stylelint-order'],
2
+ extends: ['stylelint-config-standard'],
4
3
  rules: {
5
- 'order/order': [
6
- 'dollar-variables',
7
- 'custom-properties',
8
- {
9
- type: 'at-rule',
10
- name: 'custom-media',
11
- },
12
- {
13
- type: 'at-rule',
14
- name: 'extend',
15
- },
16
- {
17
- type: 'at-rule',
18
- name: 'mixin',
19
- },
20
- 'declarations',
21
- {
22
- type: 'at-rule',
23
- name: 'supports',
24
- },
25
- {
26
- type: 'at-rule',
27
- name: 'media',
28
- hasBlock: true,
29
- },
30
- 'rules',
31
- ],
32
4
  'at-rule-disallowed-list': null,
33
5
  'at-rule-empty-line-before': [
34
6
  'always',
@@ -38,12 +10,7 @@ module.exports = {
38
10
  },
39
11
  ],
40
12
  'at-rule-no-vendor-prefix': true,
41
- 'at-rule-no-unknown': [
42
- true,
43
- {
44
- ignoreAtRules: ['mixin', 'extend', 'for', 'if', 'include', 'use', 'forward'],
45
- },
46
- ],
13
+ 'at-rule-no-unknown': true,
47
14
  'color-hex-length': 'short',
48
15
  'color-named': 'never',
49
16
  'color-no-invalid-hex': true,
@@ -72,12 +39,7 @@ module.exports = {
72
39
  'function-calc-no-unspaced-operator': true,
73
40
  'function-linear-gradient-no-nonstandard-direction': true,
74
41
  'function-name-case': 'lower',
75
- 'function-no-unknown': [
76
- true,
77
- {
78
- ignoreFunctions: ['a', 'lighten', 'darken', 'resolve'],
79
- },
80
- ],
42
+ 'function-no-unknown': true,
81
43
  'function-url-scheme-allowed-list': null,
82
44
  'function-url-no-scheme-relative': true,
83
45
  'function-url-quotes': 'always',
@@ -111,8 +73,8 @@ module.exports = {
111
73
  'selector-attribute-operator-disallowed-list': null,
112
74
  'selector-attribute-quotes': 'always',
113
75
  'selector-max-compound-selectors': 8,
114
- 'selector-max-specificity': '0,10,10',
115
- 'selector-max-id': 0,
76
+ 'selector-max-specificity': null,
77
+ 'selector-max-id': [0, { message: 'スタイル定義でIDセレクタは使わないでください' }],
116
78
  'selector-max-universal': 1,
117
79
  'selector-no-vendor-prefix': true,
118
80
  'selector-pseudo-class-disallowed-list': ['link'],
@@ -132,10 +94,4 @@ module.exports = {
132
94
  'custom-property-pattern': null,
133
95
  'selector-class-pattern': null,
134
96
  },
135
- overrides: [
136
- {
137
- files: ['__assets/**/*.scss'],
138
- customSyntax: 'postcss-scss',
139
- },
140
- ],
141
97
  };
package/index.js CHANGED
@@ -1,17 +1,19 @@
1
1
  const base = require('./base');
2
2
  const name = require('./name');
3
+ const order = require('./order');
4
+ const scss = require('./scss');
3
5
  const values = require('./values');
4
6
 
5
7
  module.exports = {
8
+ ...scss,
6
9
  ...base,
7
- ignoreFiles: [
8
- '__assets/**/*.{js,jsx,ts,tsx,html,pug}',
9
- '__assets/css/_syntax-rules.scss',
10
- 'htdocs/**/*',
11
- 'docs/**/*.md',
12
- ],
10
+ extends: [...base.extends, ...order.extends],
11
+ plugins: [...scss.plugins, ...order.plugins],
12
+ ignoreFiles: ['**/*.{js,jsx,ts,tsx,html,pug}', 'htdocs/**/*', 'docs/**/*.md'],
13
13
  rules: {
14
+ ...scss.rules,
14
15
  ...base.rules,
16
+ ...order.rules,
15
17
  ...name.rules,
16
18
  ...values.rules,
17
19
  },
package/name.js CHANGED
@@ -9,9 +9,32 @@ module.exports = {
9
9
  '^c-[a-z][a-z0-9]*(?:-[a-z0-9]+)*(?:__[a-z0-9]+(?:-[a-z0-9]+)*)?$',
10
10
  {
11
11
  resolveNestedSelectors: true,
12
+ /**
13
+ * @param {string} selector
14
+ * @returns {string}
15
+ */
16
+ message: (selector) => {
17
+ if (!selector.startsWith('.c-')) {
18
+ return `クラス名は「c-」から始めてください: ${selector}`;
19
+ }
20
+ if (selector.split('__').length > 2) {
21
+ return `「__」はコンポーネント名とエレメント名の区切りを表します。エレメント名の文字区切りは「-」を使います: ${selector}`;
22
+ }
23
+ return `クラス名に命名規則にない文字が含まれています: ${selector}`;
24
+ },
25
+ },
26
+ ],
27
+ 'selector-nested-pattern': [
28
+ '^[^.]+.*',
29
+ {
30
+ /**
31
+ * @param {string} selector
32
+ * @returns {string}
33
+ */
34
+ message: (selector) => {
35
+ return `コンポーネントのスタイル定義の中で別のコンポーネントを定義してはいけません: ${selector}`;
36
+ },
12
37
  },
13
38
  ],
14
- 'selector-id-pattern': '^$',
15
- 'selector-nested-pattern': '^[^.]+.*',
16
39
  },
17
40
  };
package/order.js ADDED
@@ -0,0 +1,33 @@
1
+ module.exports = {
2
+ extends: ['stylelint-config-recess-order'],
3
+ plugins: ['stylelint-order'],
4
+ rules: {
5
+ 'order/order': [
6
+ 'dollar-variables',
7
+ 'custom-properties',
8
+ {
9
+ type: 'at-rule',
10
+ name: 'custom-media',
11
+ },
12
+ {
13
+ type: 'at-rule',
14
+ name: 'extend',
15
+ },
16
+ {
17
+ type: 'at-rule',
18
+ name: 'mixin',
19
+ },
20
+ 'declarations',
21
+ {
22
+ type: 'at-rule',
23
+ name: 'supports',
24
+ },
25
+ {
26
+ type: 'at-rule',
27
+ name: 'media',
28
+ hasBlock: true,
29
+ },
30
+ 'rules',
31
+ ],
32
+ },
33
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@d-zero/stylelint-config",
3
- "version": "5.0.0-alpha.7",
3
+ "version": "5.0.0-alpha.9",
4
4
  "description": "Configurations of Stylelint",
5
5
  "repository": "https://github.com/d-zero-dev/linters.git",
6
6
  "author": "D-ZERO Co., Ltd.",
@@ -14,21 +14,26 @@
14
14
  ".": "./index.js",
15
15
  "./base": "./base.js",
16
16
  "./name": "./name.js",
17
+ "./order": "./order.js",
18
+ "./scss": "./scss.js",
17
19
  "./values": "./values.js"
18
20
  },
19
21
  "files": [
20
- "base.js",
21
- "index.js",
22
- "name.js",
23
- "values.js"
22
+ "*.js"
24
23
  ],
25
24
  "main": "index.js",
26
25
  "dependencies": {
27
26
  "stylelint": "16.2.1",
28
- "stylelint-config-recess-order": "4.4.0",
27
+ "stylelint-config-recess-order": "4.6.0",
29
28
  "stylelint-config-standard": "36.0.0",
30
29
  "stylelint-order": "6.0.4",
31
30
  "stylelint-scss": "6.1.0"
32
31
  },
33
- "gitHead": "5bb32f43f5fc901a5fe7d627bf10385c29ee892e"
32
+ "devDependencies": {
33
+ "postcss-scss": "4.0.9"
34
+ },
35
+ "peerDependencies": {
36
+ "postcss-scss": "4"
37
+ },
38
+ "gitHead": "ff5a444938e81afa769f11a2f964b966e09a4a41"
34
39
  }
package/scss.js ADDED
@@ -0,0 +1,18 @@
1
+ module.exports = {
2
+ customSyntax: 'postcss-scss',
3
+ plugins: ['stylelint-scss'],
4
+ rules: {
5
+ 'at-rule-no-unknown': [
6
+ true,
7
+ {
8
+ ignoreAtRules: ['mixin', 'extend', 'for', 'if', 'include', 'use', 'forward'],
9
+ },
10
+ ],
11
+ 'function-no-unknown': [
12
+ true,
13
+ {
14
+ ignoreFunctions: ['a', 'lighten', 'darken', 'resolve'],
15
+ },
16
+ ],
17
+ },
18
+ };
package/values.js CHANGED
@@ -21,7 +21,7 @@ module.exports = {
21
21
  '$root-font-size',
22
22
  '$base-font-size',
23
23
  '1em',
24
- '/^calc\\((?:\\$[a-z_][a-z0-9_-]*|(?:[0-9]*\\.)?[0-9]+) \\/ (?:\\$[a-z_][a-z0-9_-]*|(?:[0-9]*\\.)?[0-9]+) \\* (?:1em|100vw)\\)$/',
24
+ '/^calc\\(\\s*(?:\\$[a-z_][a-z0-9_-]*|(?:[0-9]*\\.)?[0-9]+) \\/ (?:\\$[a-z_][a-z0-9_-]*|(?:[0-9]*\\.)?[0-9]+) \\* (?:1em|100vw)\\s*\\)$/',
25
25
  '/^(?:[0-9]*\\.)?[0-9]+rem/',
26
26
  '/^clamp\\(/',
27
27
  ],