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

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/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.8",
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,6 +14,8 @@
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": [
@@ -25,10 +27,16 @@
25
27
  "main": "index.js",
26
28
  "dependencies": {
27
29
  "stylelint": "16.2.1",
28
- "stylelint-config-recess-order": "4.4.0",
30
+ "stylelint-config-recess-order": "4.6.0",
29
31
  "stylelint-config-standard": "36.0.0",
30
32
  "stylelint-order": "6.0.4",
31
33
  "stylelint-scss": "6.1.0"
32
34
  },
33
- "gitHead": "5bb32f43f5fc901a5fe7d627bf10385c29ee892e"
35
+ "devDependencies": {
36
+ "postcss-scss": "4.0.9"
37
+ },
38
+ "peerDependencies": {
39
+ "postcss-scss": "4"
40
+ },
41
+ "gitHead": "bf5becc2a1f3cafcaa27eb1d775758fcef1103b6"
34
42
  }
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
  ],