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

Update stylelint config #502

Merged
merged 3 commits into from
Apr 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cfpb/ccdb5-ui",
"version": "2.11.3",
"version": "2.11.2",
"description": "Consumer Complaint Database UI",
"homepage": "https://www.consumerfinance.gov/",
"repository": {
Expand Down Expand Up @@ -117,7 +117,8 @@
"release-it": "^17.2.0",
"string-replace-loader": "^3.1.0",
"stylelint": "^16.3.1",
"stylelint-config-recommended-less": "^3.0.1"
"stylelint-config-standard": "^36.0.0",
"stylelint-less": "^3.0.1"
},
"lint-staged": {
"src/**/*.{css,less}": [
Expand Down
1 change: 1 addition & 0 deletions src/components/Filters/FilterPanelToggle.less
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
@media @superwide, @desktop, @tablet-lg {
display: none;
}

@media @tablet-sm, @phone {
display: block;
width: 90vw;
Expand Down
4 changes: 4 additions & 0 deletions src/components/Tour/Tour.less
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,19 @@
@media @superwide {
margin-top: -40vh !important;
}

@media @desktop and (max-width: 1799px){
margin-top: -90vh !important;
}

@media @tablet-lg {
margin-top: -110vh !important;
}

@media @tablet-sm {
margin-top: -130vh !important;
}

@media @phone {
margin-top: -110vh !important;
}
Expand Down
57 changes: 40 additions & 17 deletions stylelint.config.js
Original file line number Diff line number Diff line change
@@ -1,46 +1,69 @@
/*
THIS FILE IS MODIFIED FROM
https://github.com/cfpb/design-system/blob/main/stylelint.config.js
*/

/* NOTES:
at-rule-no-unknown -
This rule enforces only @ rules that appear in the CSS spec,
however, @plugin appears in Less, so should be ignored.


function-parentheses-space-inside -
Custom setting that differs from stylelint-config-standard.

color-function-notation -
Set to 'legacy' to support older browsers in our browserslist (for now).
declaration-block-no-redundant-longhand-properties -
Turned off.
TODO: Turn on this rule and work out longhand properties.
declaration-empty-line-before -
Turned off.
TODO: Turn on this rule and work out what style we want.
declaration-property-value-no-unknown -
Turned off for Less per documentation guidance.
function-no-unknown -
Ignore the 'unit' helper function that comes from Less.
media-feature-range-notation -
Prefer prefixed values, since Less doesn't support ranges.
media-query-no-invalid -
Turned off because of https://github.com/ssivanatarajan/stylelint-less/issues/6
no-descending-specificity -
Turned off, but probably shouldn't be.
TODO: Turn on this rule and see if issues can be fixed.

number-max-precision -
TODO: See if long decimal values can be shortened using the unit helper.
rule-empty-line-before -
Custom setting that differs from stylelint-config-standard.

selector-id-pattern -
Turned off.
TODO: Turn on this rule and work out regex for BEM syntax.
selector-class-pattern -
Turned off.
TODO: Turn on this rule and work out regex for BEM syntax.
less/color-no-invalid-hex
less/no-duplicate-variables
Both of the above settings are turned off till
https://github.com/ssivanatarajan/stylelint-less/issues/6 is addressed.

*/
module.exports = {
extends: 'stylelint-config-recommended-less',
ignoreFiles: ['coverage/**/*.css'],
extends: ['stylelint-config-standard'],
plugins: ['stylelint-less'],
ignoreFiles: ['packages/**/node_modules/**/*.less'],
customSyntax: 'postcss-less',
rules: {
'at-rule-no-unknown': [true, { ignoreAtRules: 'plugin' }],
'function-name-case': ['lower', { ignoreFunctions: ['filter'] }],
'length-zero-no-unit': true,
'color-function-notation': ['legacy'],
'declaration-block-no-redundant-longhand-properties': null,
'declaration-empty-line-before': null,
'declaration-property-value-no-unknown': null,
'function-no-unknown': [
true,
{ ignoreFunctions: ['extend', 'fade', 'mix', 'unit'] },
],
'media-feature-range-notation': ['prefix'],
'media-query-no-invalid': null,
'no-descending-specificity': null,
'number-max-precision': 10,
'rule-empty-line-before': [
'always-multi-line',
{
except: 'first-nested',
ignore: ['after-comment', 'inside-block'],
},
],
'selector-id-pattern': null,
'selector-class-pattern': null,
'less/color-no-invalid-hex': null,
'less/no-duplicate-variables': null,
},
Expand Down
Loading