Skip to content

Commit a0406b5

Browse files
author
alexander janet
committed
fix(linter): added stylelint to improve css linting.
1 parent 374f3c7 commit a0406b5

File tree

3 files changed

+135
-54
lines changed

3 files changed

+135
-54
lines changed

.eslintrc.json

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
{
2+
"parser": "babel-eslint",
3+
"extends": ["airbnb"],
4+
"globals": {
5+
"__SERVER__": true,
6+
"__VERSION__": true
7+
},
8+
"env": {
9+
"browser": true,
10+
"node": true,
11+
"jest": true,
12+
"es6": true
13+
},
14+
"parserOptions": {
15+
"ecmaVersion": 7,
16+
"sourceType": "module",
17+
"ecmaFeatures": {
18+
"impliedStrict": true,
19+
"jsx": true
20+
}
21+
},
22+
"settings": {
23+
"import/resolver": {
24+
"node": {
25+
"extensions": [
26+
".js",
27+
".mjs"
28+
]
29+
}
30+
}
31+
},
32+
"rules": {
33+
"curly": [2, "multi-line"],
34+
"no-continue": 0,
35+
"no-duplicate-imports": 0,
36+
"no-else-return": 0,
37+
"no-prototype-builtins": 0,
38+
"no-underscore-dangle": 0,
39+
"no-unused-vars": [2],
40+
"react/destructuring-assignment": 0,
41+
"react/no-multi-comp": 0,
42+
"react/prefer-stateless-function": 0,
43+
"react/sort-comp": 0,
44+
"symbol-description": 0,
45+
"no-restricted-syntax": ["error", "ForOfStatement", "LabeledStatement", "WithStatement"],
46+
"no-return-assign": 0,
47+
"no-undef": 0,
48+
"no-plusplus": "off",
49+
"arrow-parens": [
50+
"error",
51+
"always"
52+
],
53+
"arrow-body-style": [
54+
2,
55+
"as-needed"
56+
],
57+
"comma-dangle": [
58+
2,
59+
"always-multiline"
60+
],
61+
"import/extensions": [
62+
"error",
63+
"always",
64+
{
65+
"js": "never",
66+
"mjs": "never"
67+
}
68+
],
69+
"import/imports-first": 0,
70+
"import/newline-after-import": 0,
71+
"import/no-dynamic-require": 0,
72+
"import/no-extraneous-dependencies": 0,
73+
"import/no-named-as-default": 0,
74+
"import/no-unresolved": 2,
75+
"import/prefer-default-export": 0,
76+
"indent": [
77+
2,
78+
2,
79+
{
80+
"SwitchCase": 1
81+
}
82+
],
83+
"max-len": 0,
84+
"newline-per-chained-call": 0,
85+
"no-confusing-arrow": 0,
86+
"no-console": 1,
87+
"no-use-before-define": 0,
88+
"object-curly-newline": "warn",
89+
"prefer-template": 2,
90+
"class-methods-use-this": 0,
91+
"require-yield": 0,
92+
"jsx-a11y/aria-props": 2,
93+
"jsx-a11y/heading-has-content": 0,
94+
"jsx-a11y/label-has-for": 2,
95+
"jsx-a11y/mouse-events-have-key-events": 2,
96+
"jsx-a11y/role-has-required-aria-props": 2,
97+
"jsx-a11y/role-supports-aria-props": 2,
98+
"react/forbid-prop-types": 0,
99+
"react/jsx-first-prop-new-line": [
100+
2,
101+
"multiline"
102+
],
103+
"react/jsx-filename-extension": 0,
104+
"react/jsx-no-target-blank": 0,
105+
"react/require-extension": 0,
106+
"react/self-closing-comp": 0,
107+
"react/require-default-props": 0
108+
}
109+
}

.stylelintrc

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"processors": [
3+
"stylelint-processor-styled-components"
4+
],
5+
"extends": [
6+
"stylelint-config-recommended",
7+
"stylelint-config-styled-components"
8+
],
9+
"rules": {
10+
"color-no-invalid-hex": true,
11+
"color-hex-case": "upper",
12+
"unit-no-unknown": true,
13+
"property-no-unknown": true,
14+
"at-rule-semicolon-newline-after": "always",
15+
"declaration-block-no-duplicate-properties":true,
16+
"block-no-empty": null
17+
}
18+
}

package.json

Lines changed: 8 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,12 @@
2222
"build:readme": "toctoc README.md -w",
2323
"build:dist:watch": "rollup -c --watch",
2424
"build:lib:watch": "npm run build:lib -- --watch",
25-
"test": "npm run lint && npm run test:web",
25+
"test": "npm run lint && npm run lint:css && npm run test:web",
2626
"test:web": "NODE_ENV=test TEST_REPORT_PATH=reports jest --coverage",
2727
"test:clean": "rimraf ./coverage",
2828
"test:watch": "npm run test -- --watch",
2929
"lint": "eslint src",
30+
"lint:css": "stylelint './src/**/*.js'",
3031
"prepublish": "npm run build",
3132
"lint-staged": "lint-staged",
3233
"styleguide": "styleguidist server",
@@ -58,63 +59,12 @@
5859
"Adrien Gadaud <adrien.gadaud@yeutech.vn>"
5960
],
6061
"license": "MIT",
61-
"eslintConfig": {
62-
"parser": "babel-eslint",
63-
"extends": "airbnb-base",
64-
"env": {
65-
"browser": true,
66-
"node": true,
67-
"jest": true,
68-
"es6": true
69-
},
70-
"parserOptions": {
71-
"ecmaVersion": 6,
72-
"sourceType": "module"
73-
},
74-
"rules": {
75-
"arrow-parens": [
76-
"error",
77-
"always"
78-
],
79-
"arrow-body-style": [
80-
2,
81-
"as-needed"
82-
],
83-
"comma-dangle": [
84-
2,
85-
"always-multiline"
86-
],
87-
"import/imports-first": 0,
88-
"import/newline-after-import": 0,
89-
"import/no-dynamic-require": 0,
90-
"import/no-extraneous-dependencies": 0,
91-
"import/no-named-as-default": 0,
92-
"import/no-unresolved": 2,
93-
"import/prefer-default-export": 0,
94-
"indent": [
95-
2,
96-
2,
97-
{
98-
"SwitchCase": 1
99-
}
100-
],
101-
"max-len": 0,
102-
"newline-per-chained-call": 0,
103-
"no-confusing-arrow": 0,
104-
"no-console": 1,
105-
"no-else-return": 0,
106-
"no-use-before-define": 0,
107-
"object-curly-newline": 0,
108-
"prefer-template": 2,
109-
"class-methods-use-this": 0,
110-
"require-yield": 0
111-
}
112-
},
11362
"devDependencies": {
11463
"@semantic-release/changelog": "^3.0.0",
11564
"@semantic-release/git": "^7.0.5",
11665
"@semantic-release/github": "^5.2.1",
11766
"@semantic-release/npm": "^4.0.0",
67+
"@yeutech-lab/rollup-umd-documentation": "^2.4.4",
11868
"babel-cli": "^6.26.0",
11969
"babel-core": "^6.26.0",
12070
"babel-eslint": "^7.2.3",
@@ -147,7 +97,7 @@
14797
"pre-commit": "^1.2.2",
14898
"react": "^16.4.1",
14999
"react-dom": "^16.4.1",
150-
"react-styleguidist": "7.1.0",
100+
"react-styleguidist": "^8.0.4",
151101
"rimraf": "^2.6.2",
152102
"rollup": "^0.57.1",
153103
"rollup-plugin-babel": "^3.0.3",
@@ -163,6 +113,10 @@
163113
"rollup-watch": "^4.3.1",
164114
"semantic-release": "^15.8.0",
165115
"sinon": "^3.3.0",
116+
"stylelint": "^9.8.0",
117+
"stylelint-config-recommended": "^2.1.0",
118+
"stylelint-config-styled-components": "^0.1.1",
119+
"stylelint-processor-styled-components": "^1.5.1",
166120
"toctoc": "^0.3.0",
167121
"webpack": "^4.16.1"
168122
},

0 commit comments

Comments
 (0)