Skip to content

Commit a205725

Browse files
authored
feat: add stylelint for css-in-js (#815)
* feat: add css linting
1 parent 8269fb3 commit a205725

File tree

4 files changed

+1145
-25
lines changed

4 files changed

+1145
-25
lines changed

.stylelintrc

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"extends": [
3+
"stylelint-config-standard",
4+
"stylelint-config-prettier"
5+
],
6+
"plugins": [
7+
"stylelint-order"
8+
],
9+
"rules": {
10+
"font-family-name-quotes": ["always-unless-keyword"],
11+
"function-url-quotes": "always",
12+
"selector-attribute-quotes": "always",
13+
"string-quotes": "single",
14+
"selector-pseudo-class-no-unknown": [
15+
true,
16+
{ "ignorePseudoClasses": ["global"] }
17+
],
18+
"order/properties-order": [
19+
["composes"],
20+
{ "unspecified": "bottom" }
21+
],
22+
"declaration-block-no-duplicate-properties": [
23+
true,
24+
{ "ignoreProperties": ["composes"] }
25+
],
26+
"property-no-unknown": [
27+
true,
28+
{ "ignoreProperties": ["composes"] }
29+
],
30+
"declaration-colon-newline-after": null,
31+
"rule-empty-line-before": null,
32+
"value-list-comma-newline-after": null,
33+
"indentation": null,
34+
"selector-descendant-combinator-no-non-space": null,
35+
"no-descending-specificity": null,
36+
"no-duplicate-selectors": null,
37+
"no-empty-source": null,
38+
"declaration-empty-line-before": null,
39+
"no-missing-end-of-source-newline": null,
40+
"function-name-case": null,
41+
}
42+
}

jest.stylelint.config.js

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
module.exports = {
2+
runner: 'jest-runner-stylelint',
3+
displayName: 'stylelint',
4+
moduleFileExtensions: ['js'],
5+
modulePathIgnorePatterns: [
6+
'dist',
7+
'.spec.js',
8+
'.visualspec.js',
9+
'.visualroute.js',
10+
'.story.js',
11+
],
12+
testMatch: ['<rootDir>/src/components/**/*.js', ''],
13+
watchPlugins: ['jest-watch-typeahead/filename', 'jest-watch-master'],
14+
};

package.json

+9
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
"i18n:build": "node scripts/extract-intl.js --output-path=$(pwd)/i18n/data 'src/components/**/!(*.spec).js'",
4949
"lint": "jest --projects jest.eslint.config.js",
5050
"lint:js": "jest --config jest.eslint.config.js",
51+
"lint:css": "jest --config jest.stylelint.config.js",
5152
"format:js": "prettier --write '**/*.js'",
5253
"format:md": "prettier --write --parser markdown '**/*.md'",
5354
"format:yaml": "prettier --write --parser yaml '**/*.yaml'",
@@ -149,6 +150,7 @@
149150
"jest-localstorage-mock": "2.4.0",
150151
"jest-puppeteer": "4.1.1",
151152
"jest-runner-eslint": "0.7.3",
153+
"jest-runner-stylelint": "1.0.0",
152154
"jest-silent-reporter": "0.1.2",
153155
"jest-validate": "24.8.0",
154156
"jest-watch-master": "1.0.0",
@@ -183,6 +185,10 @@
183185
"serve": "11.0.0",
184186
"shelljs": "0.8.3",
185187
"storybook-readme": "5.0.3",
188+
"stylelint": "10.0.1",
189+
"stylelint-config-prettier": "5.2.0",
190+
"stylelint-config-standard": "18.3.0",
191+
"stylelint-order": "3.0.0",
186192
"webpack": "4.32.2",
187193
"webpack-cli": "3.3.2",
188194
"yaml": "1.6.0",
@@ -196,6 +202,9 @@
196202
"react-intl": "2.x",
197203
"react-router-dom": "5.x"
198204
},
205+
"resolutions": {
206+
"jest-runner-stylelint/stylelint": "10.0.1"
207+
},
199208
"husky": {
200209
"hooks": {
201210
"commit-msg": "commitlint -e $HUSKY_GIT_PARAMS",

0 commit comments

Comments
 (0)