Skip to content

Commit 1cb2574

Browse files
frenzzyokendoken
authored andcommitted
Add stylelint-order; remove stylefmt in favor of stylelint --fix (#1310)
1 parent 93794a6 commit 1cb2574

File tree

6 files changed

+112
-127
lines changed

6 files changed

+112
-127
lines changed

.eslintrc.js

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -10,56 +10,56 @@
1010
// ESLint configuration
1111
// http://eslint.org/docs/user-guide/configuring
1212
module.exports = {
13-
parser: 'babel-eslint',
13+
parser: 'babel-eslint',
1414

15-
extends: [
16-
'airbnb',
17-
'plugin:css-modules/recommended',
18-
],
15+
extends: [
16+
'airbnb',
17+
'plugin:css-modules/recommended',
18+
],
1919

20-
plugins: [
21-
'css-modules',
22-
],
20+
plugins: [
21+
'css-modules',
22+
],
2323

24-
globals: {
25-
__DEV__: true,
26-
},
24+
globals: {
25+
__DEV__: true,
26+
},
2727

28-
env: {
29-
browser: true,
30-
},
28+
env: {
29+
browser: true,
30+
},
3131

32-
rules: {
33-
// `js` and `jsx` are common extensions
34-
// `mjs` is for `universal-router` only, for now
35-
'import/extensions': [
36-
'error',
37-
'always',
38-
{
39-
js: 'never',
40-
jsx: 'never',
41-
mjs: 'never',
42-
},
43-
],
32+
rules: {
33+
// `js` and `jsx` are common extensions
34+
// `mjs` is for `universal-router` only, for now
35+
'import/extensions': [
36+
'error',
37+
'always',
38+
{
39+
js: 'never',
40+
jsx: 'never',
41+
mjs: 'never',
42+
},
43+
],
4444

45-
// Not supporting nested package.json yet
46-
// https://github.com/benmosher/eslint-plugin-import/issues/458
47-
'import/no-extraneous-dependencies': 'off',
45+
// Not supporting nested package.json yet
46+
// https://github.com/benmosher/eslint-plugin-import/issues/458
47+
'import/no-extraneous-dependencies': 'off',
4848

49-
// Recommend not to leave any console.log in your code
50-
// Use console.error, console.warn and console.info instead
51-
'no-console': [
52-
'error',
53-
{
54-
allow: ['warn', 'error', 'info'],
55-
},
56-
],
49+
// Recommend not to leave any console.log in your code
50+
// Use console.error, console.warn and console.info instead
51+
'no-console': [
52+
'error',
53+
{
54+
allow: ['warn', 'error', 'info'],
55+
},
56+
],
5757

58-
// Allow js files to use jsx syntax, too
59-
'react/jsx-filename-extension': 'off',
58+
// Allow js files to use jsx syntax, too
59+
'react/jsx-filename-extension': 'off',
6060

61-
// https://github.com/kriasoft/react-starter-kit/pull/961
62-
// You can reopen this if you still want this rule
63-
'react/prefer-stateless-function': 'off',
64-
},
65-
};
61+
// https://github.com/kriasoft/react-starter-kit/pull/961
62+
// You can reopen this if you still want this rule
63+
'react/prefer-stateless-function': 'off',
64+
},
65+
};

.gitignore

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,30 @@
1-
# Include your project-specific ignores in this file
2-
# Read about how to use .gitignore: https://help.github.com/articles/ignoring-files
1+
# See https://help.github.com/ignore-files/ for more about ignoring files.
32

4-
.idea
3+
# Dependencies
4+
node_modules/
5+
6+
# Compiled output
57
build
8+
9+
# Runtime data
610
database.sqlite
7-
node_modules
8-
npm-debug.log
9-
yarn-error.log
11+
12+
# Test coverage
1013
coverage
1114
.nyc_output
15+
16+
# Logs
17+
npm-debug.log*
18+
yarn-debug.log*
19+
yarn-error.log*
20+
21+
# Editors and IDEs
22+
.idea
23+
.vscode/*
24+
!.vscode/settings.json
25+
!.vscode/tasks.json
26+
!.vscode/launch.json
27+
!.vscode/extensions.json
28+
29+
# Misc
30+
.DS_Store

.stylelintrc.js

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,42 @@ module.exports = {
1515
// https://github.com/stylelint/stylelint-config-standard
1616
extends: 'stylelint-config-standard',
1717

18+
plugins: [
19+
// stylelint plugin to sort CSS rules content with specified order
20+
// https://github.com/hudochenkov/stylelint-order
21+
'stylelint-order',
22+
],
23+
1824
rules: {
1925
'property-no-unknown': [true, {
2026
ignoreProperties: [
2127
// CSS Modules composition
2228
// https://github.com/css-modules/css-modules#composition
23-
'composes'
24-
]
29+
'composes',
30+
],
2531
}],
2632

2733
'selector-pseudo-class-no-unknown': [true, {
2834
ignorePseudoClasses: [
2935
// CSS Modules :global scope
3036
// https://github.com/css-modules/css-modules#exceptions
31-
'global'
32-
]
37+
'global',
38+
],
3339
}],
3440

3541
// Opinionated rule, you can disable it if you want
3642
'string-quotes': 'single',
43+
44+
// https://github.com/hudochenkov/stylelint-order/blob/master/rules/order/README.md
45+
'order/order': [
46+
'custom-properties',
47+
'dollar-variables',
48+
'declarations',
49+
'at-rules',
50+
'rules',
51+
],
52+
53+
// https://github.com/hudochenkov/stylelint-order/blob/master/rules/properties-order/README.md
54+
'order/properties-order': [],
3755
},
3856
};

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
language: node_js
22
node_js:
3+
- '8'
34
- '7'
45
- '6'
56
env:

package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,9 @@
123123
"rimraf": "^2.6.1",
124124
"sass-loader": "6.0.3",
125125
"sinon": "^2.3.4",
126-
"stylefmt": "^6.0.0",
127126
"stylelint": "^7.11.0",
128127
"stylelint-config-standard": "^16.0.0",
128+
"stylelint-order": "^0.5.0",
129129
"url-loader": "^0.5.8",
130130
"webpack": "^2.6.1",
131131
"webpack-bundle-analyzer": "^2.8.2",
@@ -165,13 +165,12 @@
165165
"git add"
166166
],
167167
"*.{css,less,scss,sss}": [
168-
"stylefmt",
169-
"stylelint",
168+
"stylelint --fix",
170169
"git add"
171170
]
172171
},
173172
"scripts": {
174-
"lint:js": "eslint src tools",
173+
"lint:js": "eslint --ignore-path .gitignore --ignore-pattern \"!**/.*\" .",
175174
"lint:css": "stylelint \"src/**/*.{css,less,scss,sss}\"",
176175
"lint:staged": "lint-staged",
177176
"lint": "yarn run lint:js && yarn run lint:css",

0 commit comments

Comments
 (0)