-
Notifications
You must be signed in to change notification settings - Fork 414
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
Stylelint preprocessor #140
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
cf6f785
initial implementation
zamotany dec769b
MVP of stylelint preprocessor
zamotany 51a9e66
lint styles on circle ci
zamotany 3fb595d
add test and fix babel preset error
zamotany 87418a2
fix flow errors
zamotany 995cbc7
fix test error
zamotany 945166c
fix test
zamotany b04b4b7
update yarn lock file
zamotany 35f4c0d
fix circle ci config
zamotany 327ab71
add linaria stylelint config
zamotany 90bba7a
add documentation
zamotany 1fe1902
Merge branch 'master' into linter
zamotany 059adec
lint css on circle CI
zamotany 6d67651
fix website's package.json
zamotany 522a5af
fix errors
zamotany ef5fd80
move processor and syntax properties to linaria stylelint config
zamotany a5d1990
update docs
zamotany 81d37cc
more tweaks
zamotany 31c2e56
fix linter
zamotany d2adfbc
tweak linaria overrides name
zamotany cb706a4
remove unnecessary rules from stylelint config
zamotany 9a11aba
update snapshots
zamotany 8d8ae9b
store raw styles in sheet module
zamotany 4b0c6f8
fix tests
zamotany 302edc6
ignore server folder from website
zamotany 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ coverage/ | |
flow-typed/ | ||
node_modules/ | ||
vendor/ | ||
website/static/server |
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 |
---|---|---|
@@ -1,10 +1,16 @@ | ||
/* eslint-disable global-require */ | ||
|
||
module.exports = function linariaBabelPreset(context, opts = {}) { | ||
const options = Object.assign( | ||
opts, | ||
// Escape hatch for overwriting linaria preset's options. | ||
JSON.parse(process.env.LINARIA_BABEL_PRESET_OVERRIDES || '{}') | ||
); | ||
|
||
return { | ||
plugins: [ | ||
[require('./build/babel/preval-extract').default, opts], | ||
[require('./build/babel/rewire-imports').default, opts], | ||
[require('./build/babel/preval-extract').default, options], | ||
[require('./build/babel/rewire-imports').default, options], | ||
], | ||
}; | ||
}; |
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,41 @@ | ||
# Linting | ||
|
||
## stylelint | ||
|
||
For linting styles with [stylelint](https://stylelint.io/), we provide our custom config tailored for linaria - `linaria/stylelint-config` based on [`stylelint-config-recommended`](https://github.com/stylelint/stylelint-config-recommended). | ||
|
||
### Installation | ||
|
||
Both `stylelint` and `stylelint-config-recommended` are `peerDependencies` so you need to install them manually: | ||
|
||
```bash | ||
yarn add stylelint stylelint-config-recommended --dev | ||
``` | ||
|
||
### Configuring stylelint | ||
|
||
All you need to do is to set your config to extend from `linaria/stylelint-config`. | ||
|
||
Here's the example `.stylelintrc` configuration file: | ||
|
||
```json | ||
{ | ||
"extends": [ | ||
"linaria/stylelint-config" | ||
] | ||
} | ||
``` | ||
|
||
Please refer to the [official stylelint documentation](https://stylelint.io/user-guide/configuration/) for more info about configuration. | ||
|
||
### Running the linter | ||
|
||
Add the following to your `package.json` scripts: | ||
|
||
```json | ||
"lint:css": "stylelint src/**/*.js" | ||
``` | ||
|
||
Now, you can run `yarn lint:css` to run the linter. | ||
|
||
For more information refer to [stylelint documentation](https://stylelint.io/user-guide/cli/). |
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
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
Oops, something went wrong.
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.
maybe we should do
instead?