-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add stylelint #1216
Closed
Closed
Add stylelint #1216
Changes from 11 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
69fc63d
Add Stylelint with standard config
karlhorky 0841ae6
Prevent linting built CSS files
karlhorky 6ad3701
Eject Stylelint configuration
karlhorky da448c8
Bump version
karlhorky 0d49152
Configure files to lint with stylelint
karlhorky 809f38b
Add configBaseDir to fix tests
karlhorky 2575f77
Fix configuration option
karlhorky 4522aa7
Add custom stylelint config without style rules
karlhorky 8d8b494
Fix stylelint config
karlhorky 80f2116
Merge branch 'master' of github.com:facebookincubator/create-react-ap…
karlhorky 56d9ac4
Add stylelint dependencies
karlhorky df58946
Remove extra dependencies, cd for tests
karlhorky a031b66
Add back stylelint dev dependency, don't cd
karlhorky f6474b3
Merge branch 'master' of github.com:facebookincubator/create-react-ap…
karlhorky c8c51fb
Move stylelint css validator to config dev deps
karlhorky 3290445
Merge branch 'master' of github.com:facebookincubator/create-react-ap…
karlhorky 2f535b4
Merge branch 'next' of github.com:facebookincubator/create-react-app …
karlhorky File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# stylelint-config-react-app | ||
|
||
This package includes the shareable stylelint configuration used by [Create React App](https://github.com/facebookincubator/create-react-app).<br> | ||
Please refer to its documentation: | ||
|
||
* [Getting Started](https://github.com/facebookincubator/create-react-app/blob/master/README.md#getting-started) – How to create a new app. | ||
* [User Guide](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md) – How to develop apps bootstrapped with Create React App. | ||
|
||
## Usage in Create React App Projects | ||
|
||
The easiest way to use this configuration is with [Create React App](https://github.com/facebookincubator/create-react-app), which includes it by default. **You don’t need to install it separately in Create React App projects.** | ||
|
||
## Usage Outside of Create React App | ||
|
||
If you want to use this stylelint configuration in a project not built with Create React App, you can install it with following steps. | ||
|
||
First, install this package, stylelint and the necessary plugins. | ||
|
||
```sh | ||
npm install --save-dev stylelint-config-react-app stylelint@7.10.1 stylelint-csstree-validator@1.1.1 | ||
``` | ||
|
||
Then create a file named `.stylelintrc` with following contents in the root folder of your project: | ||
|
||
```js | ||
{ | ||
"extends": "stylelint-config-react-app" | ||
} | ||
``` | ||
|
||
That's it! You can override the settings from `stylelint-config-react-app` by editing the `.stylelintrc` file. Learn more about [configuring stylelint](https://stylelint.io/user-guide/configuration/) on the stylelint website. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
'use strict'; | ||
|
||
module.exports = { | ||
plugins: ['stylelint-csstree-validator'], | ||
rules: { | ||
'at-rule-no-unknown': true, | ||
'color-no-invalid-hex': true, | ||
'declaration-block-no-duplicate-properties': true, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wouldn't be better to use declaration-block-no-duplicate-properties with Moreover, is this rule blocks the pattern of (Added example)?
|
||
'declaration-block-no-shorthand-property-overrides': true, | ||
'function-linear-gradient-no-nonstandard-direction': true, | ||
'media-feature-name-no-unknown': true, | ||
'no-invalid-double-slash-comments': true, | ||
'no-unknown-animations': true, | ||
'property-no-unknown': true, | ||
'selector-pseudo-class-no-unknown': true, | ||
'selector-pseudo-element-no-unknown': true, | ||
'selector-type-no-unknown': true, | ||
'string-no-newline': true, | ||
'unit-no-unknown': true, | ||
|
||
// csstree syntax validator https://github.com/csstree/stylelint-validator | ||
'csstree/validator': true, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"name": "stylelint-config-react-app", | ||
"version": "0.0.1", | ||
"description": "stylelint configuration used by Create React App", | ||
"repository": "facebookincubator/create-react-app", | ||
"license": "BSD-3-Clause", | ||
"bugs": { | ||
"url": "https://github.com/facebookincubator/create-react-app/issues" | ||
}, | ||
"files": [ | ||
"index.js" | ||
], | ||
"peerDependencies": { | ||
"stylelint": "^7.10.1", | ||
"stylelint-csstree-validator": "^1.1.1" | ||
}, | ||
"dependencies": { | ||
"stylelint": "^7.10.1", | ||
"stylelint-csstree-validator": "^1.1.1" | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems
allowEmptyInput
have been removed.stylelint/stylelint#2464
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, this was merged into the
v8
branch. However version 8 is not yet out. The current version on npm is7.10.1
however, so we cannot yet switch to this.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we note that this should be removed when we update to ^8?