Skip to content

Commit

Permalink
Add stylelint-order; remove stylefmt in favor of stylelint --fix (kri…
Browse files Browse the repository at this point in the history
  • Loading branch information
frenzzy authored Jun 12, 2017
1 parent 9f4f761 commit 8efcee1
Show file tree
Hide file tree
Showing 6 changed files with 112 additions and 127 deletions.
88 changes: 44 additions & 44 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,56 +10,56 @@
// ESLint configuration
// http://eslint.org/docs/user-guide/configuring
module.exports = {
parser: 'babel-eslint',
parser: 'babel-eslint',

extends: [
'airbnb',
'plugin:css-modules/recommended',
],
extends: [
'airbnb',
'plugin:css-modules/recommended',
],

plugins: [
'css-modules',
],
plugins: [
'css-modules',
],

globals: {
__DEV__: true,
},
globals: {
__DEV__: true,
},

env: {
browser: true,
},
env: {
browser: true,
},

rules: {
// `js` and `jsx` are common extensions
// `mjs` is for `universal-router` only, for now
'import/extensions': [
'error',
'always',
{
js: 'never',
jsx: 'never',
mjs: 'never',
},
],
rules: {
// `js` and `jsx` are common extensions
// `mjs` is for `universal-router` only, for now
'import/extensions': [
'error',
'always',
{
js: 'never',
jsx: 'never',
mjs: 'never',
},
],

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

// Recommend not to leave any console.log in your code
// Use console.error, console.warn and console.info instead
'no-console': [
'error',
{
allow: ['warn', 'error', 'info'],
},
],
// Recommend not to leave any console.log in your code
// Use console.error, console.warn and console.info instead
'no-console': [
'error',
{
allow: ['warn', 'error', 'info'],
},
],

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

// https://github.com/kriasoft/react-starter-kit/pull/961
// You can reopen this if you still want this rule
'react/prefer-stateless-function': 'off',
},
};
// https://github.com/kriasoft/react-starter-kit/pull/961
// You can reopen this if you still want this rule
'react/prefer-stateless-function': 'off',
},
};
31 changes: 25 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,30 @@
# Include your project-specific ignores in this file
# Read about how to use .gitignore: https://help.github.com/articles/ignoring-files
# See https://help.github.com/ignore-files/ for more about ignoring files.

.idea
# Dependencies
node_modules/

# Compiled output
build

# Runtime data
database.sqlite
node_modules
npm-debug.log
yarn-error.log

# Test coverage
coverage
.nyc_output

# Logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Editors and IDEs
.idea
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

# Misc
.DS_Store
26 changes: 22 additions & 4 deletions .stylelintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,42 @@ module.exports = {
// https://github.com/stylelint/stylelint-config-standard
extends: 'stylelint-config-standard',

plugins: [
// stylelint plugin to sort CSS rules content with specified order
// https://github.com/hudochenkov/stylelint-order
'stylelint-order',
],

rules: {
'property-no-unknown': [true, {
ignoreProperties: [
// CSS Modules composition
// https://github.com/css-modules/css-modules#composition
'composes'
]
'composes',
],
}],

'selector-pseudo-class-no-unknown': [true, {
ignorePseudoClasses: [
// CSS Modules :global scope
// https://github.com/css-modules/css-modules#exceptions
'global'
]
'global',
],
}],

// Opinionated rule, you can disable it if you want
'string-quotes': 'single',

// https://github.com/hudochenkov/stylelint-order/blob/master/rules/order/README.md
'order/order': [
'custom-properties',
'dollar-variables',
'declarations',
'at-rules',
'rules',
],

// https://github.com/hudochenkov/stylelint-order/blob/master/rules/properties-order/README.md
'order/properties-order': [],
},
};
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
language: node_js
node_js:
- '8'
- '7'
- '6'
env:
Expand Down
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@
"react-test-renderer": "^15.5.4",
"rimraf": "^2.6.1",
"sinon": "^2.3.4",
"stylefmt": "^6.0.0",
"stylelint": "^7.11.0",
"stylelint-config-standard": "^16.0.0",
"stylelint-order": "^0.5.0",
"url-loader": "^0.5.8",
"webpack": "^2.6.1",
"webpack-bundle-analyzer": "^2.8.2",
Expand Down Expand Up @@ -150,13 +150,12 @@
"git add"
],
"*.{css,less,scss,sss}": [
"stylefmt",
"stylelint",
"stylelint --fix",
"git add"
]
},
"scripts": {
"lint:js": "eslint src tools",
"lint:js": "eslint --ignore-path .gitignore --ignore-pattern \"!**/.*\" .",
"lint:css": "stylelint \"src/**/*.{css,less,scss,sss}\"",
"lint:staged": "lint-staged",
"lint": "yarn run lint:js && yarn run lint:css",
Expand Down
Loading

0 comments on commit 8efcee1

Please sign in to comment.