Repository navigation
Add stylelint CLI and Add mapbox class name rule in stylelintrc - #4584
Conversation
WIP modify lint-css script in package.json Ammend warning for lint-css npm script Add csscolorparser
f70a41a to
ee56ee5
Compare
|
@anandthakker - the Circle CI tests are failing but not for my PR issue. |
mollymerp
left a comment
There was a problem hiding this comment.
Thank you for contributing to Mapbox GL JS @asantos3026!
The CI tests appear to be failing due to a missing flow type within the stylelint module. We do want to make sure that all css classes in dist/mapbox-gl.css are prefixed with mapboxgl-, am hesitant to add three new dependencies to solve this gap in coverage.
| 'use strict'; | ||
|
|
||
| mapboxgl.accessToken = getAccessToken(); | ||
| require('dotenv').config() |
There was a problem hiding this comment.
what was the reason for adding this change?
There was a problem hiding this comment.
I was trying to access the mapbox API via a .env file that would include my keys. I realize I do not need to do that because I use the command line to get access to the API. I deleted line 4 above.
| { | ||
| "rules": { | ||
| "selector-class-pattern": "mapbox[a-z-]+", | ||
| "color-hex-case": "lower", |
There was a problem hiding this comment.
I'm not sure we need the color rules. we rarely change dist/mapbox-gl.css and we don't deal with much color in there.
There was a problem hiding this comment.
Took out the color rules
| "@mapbox/whoots-js": "^3.0.0", | ||
| "brfs": "^1.4.0", | ||
| "bubleify": "^0.7.0", | ||
| "dotenv": "^4.0.0", |
There was a problem hiding this comment.
I dont think we need this dependency
There was a problem hiding this comment.
took out the dotenv dependency
| "clipboard": "^1.5.12", | ||
| "concat-stream": "^1.6.0", | ||
| "coveralls": "^2.11.8", | ||
| "csscolorparser": "^1.0.3", |
There was a problem hiding this comment.
I think we can do without this dependency too
There was a problem hiding this comment.
took out this dependency
| "start-docs": "npm run build-min && npm run build-docs && jekyll serve --watch", | ||
| "lint": "eslint --cache --ignore-path .gitignore src test bench docs/_posts/examples/*.html debug/*.html", | ||
| "lint-docs": "documentation lint src/index.js", | ||
| "lint-css": "stylelint 'docs/*.css' || true", |
There was a problem hiding this comment.
I think you should be pointing the linter at dist/mapbox-gl.css and not the docs/ css files. We only enforce the mapboxgl- prefex for css classes that ship with the library distribution. The CSS in the docs/ folder is only for the mapbox documentation website - www.mapbox.com/mapbox-gl-js/api
That change might also remove the need for the || true statement, although I'm not 100% clear on what that is doing in this case.
| @@ -0,0 +1 @@ | |||
| MAPBOX_ACCESS_TOKEN=sk.eyJ1IjoiYXNhbnRvczMwMjYiLCJhIjoiY2oxY293bGk4MDA2NDMzcGRxNGdyc3lpbSJ9.uxcZ_o19abopWFm2vwstmg No newline at end of file | |||
There was a problem hiding this comment.
We'd like to avoid committing personal access tokens to the GitHub repo. Developers will need to use their own token with the library.
|
Ah just saw your discussion w @anandthakker on #4584 👍 on adding closes #4584 |
|
In order to get CI to pass based on I think you'll need to add a line ignoring |
| "start-docs": "npm run build-min && npm run build-docs && jekyll serve --watch", | ||
| "lint": "eslint --cache --ignore-path .gitignore src test bench docs/_posts/examples/*.html debug/*.html", | ||
| "lint-docs": "documentation lint src/index.js", | ||
| "lint-css": "stylelint 'dist/mapbox-gl.css' || true", |
There was a problem hiding this comment.
can we remove the || true statements from here and the test-flow command – I'm afraid they will prevent the tests from failing if there are errors.
|
@mollymerp Hey Molly! I made all of the following changes:
Let me know if there is anything else I need to do to clean up my PR 👍 |
|
great! thank you so much @asantos3026!! |
Launch Checklist
added stylelint as a dev dependency
added npm script lint-css
added rule in stylelintrc to make sure all selectors begin with mapbox
tested npm script in CLI to make sure it works
amended npm warning by adding || true to the script
briefly describe the changes in this PR