Skip to content
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
merged 25 commits into from
Nov 2, 2017
Merged

Stylelint preprocessor #140

merged 25 commits into from
Nov 2, 2017

Conversation

zamotany
Copy link
Contributor

Closes #8

We need to figure out some nice stylelint config.

'test.js': {
template: ['\n color: blue;\n'],
expressions: [],
classname: header,
Copy link
Member

@thymikee thymikee Oct 18, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be explicitly 'header__1r77qux'?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it should be the same classname as the one returned from css.named.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok!

@thymikee
Copy link
Member

Can you also update the lockfile?

@codecov
Copy link

codecov bot commented Oct 18, 2017

Codecov Report

Merging #140 into master will increase coverage by 0.04%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #140      +/-   ##
==========================================
+ Coverage   97.53%   97.58%   +0.04%     
==========================================
  Files          19       19              
  Lines         406      414       +8     
  Branches       83       87       +4     
==========================================
+ Hits          396      404       +8     
  Misses         10       10
Impacted Files Coverage Δ
src/babel/preval-extract/prevalStyles.js 100% <100%> (ø) ⬆️
src/css.js 100% <100%> (ø) ⬆️
src/babel/preval-extract/resolveSource.js 100% <100%> (ø) ⬆️
src/sheet.js 96% <100%> (+0.76%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6d3a125...302edc6. Read the comment docs.

'at-rule-semicolon-newline-after': 'always',
'max-empty-lines': 1,
'no-empty-source': null,
'length-zero-no-unit': true,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't this a style thing? 😬

src/css.js Outdated
@@ -5,6 +5,12 @@ import slugify from './slugify';
import sheet from './sheet';
import { getFramesFromStack, enhanceFrames } from './babel/lib/errorUtils';

const rawStyles = {};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since we usually do the caching stuff inside sheet, I'd suggest to move this there

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, styles in sheet are already processed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean to add a new variable for unprocessed styles in sheet instead of in css

}

export default function linariaStylelintPreprocessor(/* options */) {
process.env.LINARIA_OVERWRITE_BABEL_PRESET = JSON.stringify({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe call this LINARIA_BABEL_PRESET_OPTIONS or LINARIA_BABEL_PRESET_OVERRIDES

'at-rule-semicolon-newline-after': 'always',
'max-empty-lines': 1,
'no-empty-source': null,
'length-zero-no-unit': true,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's remove style rules such as max-empty-lines, at-rule-semicolon-newline-after, length-zero-no-unit and provide a base config which caches only errors. style rules will be addressed by prettier anyway.

@@ -0,0 +1,7 @@
{
"processors": ["linaria/stylelint-preprocessor"],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can processors and syntax be inside our config? does it make sense?

- run: |
cd website && yarn run build:all && cd ..
- run: cd website && yarn run build:all && cd ..
- run: cd website && yarn run lint-css && cd ..
Copy link
Member

@satya164 satya164 Oct 27, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we should do

- run : |
    cd website
    yarn run build:all
    yarn run lint-css
    cd ..

instead?

.eslintignore Outdated
@@ -4,3 +4,4 @@ coverage/
flow-typed/
node_modules/
vendor/
website/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we shouldn't ignore website from linting

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should otherwise it will throw some weird errors

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✖ 551 problems (494 errors, 57 warnings)

all of them from website

@satya164 satya164 merged commit 647060f into master Nov 2, 2017
@satya164 satya164 deleted the linter branch November 2, 2017 14:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants