GithubHelp home page GithubHelp logo

stylelint-scss / stylelint-config-recommended-scss Goto Github PK

View Code? Open in Web Editor NEW
231.0 6.0 21.0 2.39 MB

The recommended shareable SCSS config for Stylelint

License: MIT License

JavaScript 45.51% SCSS 54.49%
stylelint scss linter-config

stylelint-config-recommended-scss's Introduction

stylelint-scss

npm version Build Status Coverage Status contributions welcome Downloads per month

A collection of SCSS-specific linting rules for Stylelint (in a form of a plugin).

Purpose

Stylelint by itself supports SCSS syntax very well (as well as other preprocessors' syntaxes). Moreover, it introduces some specific rules that can be used to lint SCSS, e.g. to limit nesting, control the way @-rules are written. Yet Stylelint is in general focused on standard CSS.

stylelint-scss introduces rules specific to SCSS syntax. That said, the rules from this plugin can be used with other syntaxes, like Less or some PostCSS syntaxes. That's why the rules' names are not tied to SCSS only (at-function-pattern instead of scss-function-pattern).

The plugin follows Stylelint's guidelines (about rule names, testing and so on).

Installation and usage

This plugin is used in the stylelint-config-standard-scss shared config. We recommend using that shared config, rather than installing this plugin directly.

However, the plugin can still be used in you're crafting a config from the ground up. First, install stylelint-scss (and stylelint, if you haven't done so yet) via npm:

npm install stylelint stylelint-scss

Create the .stylelintrc.json config file (or open the existing one), add stylelint-scss to the plugins array and the rules you need to the rules list. All rules from stylelint-scss need to be namespaced with scss.

{
  "plugins": ["stylelint-scss"],
  "rules": {
    // recommended rules
    "at-rule-no-unknown": null,
    "scss/at-rule-no-unknown": true,
    // ...
    // any other rules you'd want to change e.g.
    "scss/dollar-variable-pattern": "^foo",
    "scss/selector-no-redundant-nesting-selector": true
  }
}

Please refer to Stylelint docs for detailed info on using this linter.

List of rules

Here are stylelint-scss' rules, grouped by the thing they apply to (just like in Stylelint).

Please also see the example configs for special cases.

@-each

  • at-each-key-value-single-line: This is a rule that checks for situations where users have done a loop using map-keys or map.keys and grabbed the value for that key inside of the loop.

@-else

@-extend

@-function

@-if

@-import

@-mixin

@-rule

@-use

$-variable

%-placeholder

//-comment

Block

Comment

Declaration

Dimension

Function

Map

Media feature

Operator

Partial

Property

Selector

Load

General / Sheet

Deprecated

These rules are deprecated β€” we won't fix bugs nor add options, and we will remove them in the next major release. We recommend you use a pretty printer (like Prettier) alongside Stylelint rather than these rules.

Help out

The work on the plugin's rules is still in progress, so if you feel like it, you're welcome to help out with any of these (the plugin follows Stylelint guidelines so most of this is based on its docs):

  • Create, enhance, and debug rules (see Stylelint's guide to "Working on rules").
  • Improve documentation.
  • Chime in on any open issue or pull request.
  • Open new issues about your ideas on new rules, or for how to improve the existing ones, and pull requests to show us how your idea works.
  • Add new tests to absolutely anything.
  • Work on improving performance of rules.
  • Contribute to Stylelint
  • Spread the word.

We communicate via issues and pull requests.

There is also StackOverflow, which would be the preferred QA forum.

Contributors

Thanks goes to these wonderful people:

kristerkari dryoma rambleraptor XhmikosR ybiquitous Eugeno
kristerkari dryoma rambleraptor XhmikosR ybiquitous Eugeno
pamelalozano16 joseph118 stof niksy kaysonwu srawlins
pamelalozano16 joseph118 stof niksy kaysonwu srawlins
pipopotamasu jhae-de OriR ntwb ricardogobbosouza jeddy3
pipopotamasu jhae-de OriR ntwb ricardogobbosouza jeddy3
evilebottnawi FloEdelmann kevindew thibaudcolas chimurai vseventer
evilebottnawi FloEdelmann kevindew thibaudcolas chimurai vseventer
xboy2012 chalkygames123 bjankord AndyOGo qmhc freezy-sk
xboy2012 chalkygames123 bjankord AndyOGo qmhc freezy-sk
YodaDaCoda wlewis-formative kersh AM-77 YozhikM sajadtorkamani
YodaDaCoda wlewis-formative kersh AM-77 YozhikM sajadtorkamani
paulgv 01taylop nlydv manovotny keegan-lillo stormwarning
paulgv 01taylop nlydv manovotny keegan-lillo stormwarning
jantimon guoyunhe G-Rath EvanHahn lithiumlron diego-codes
jantimon guoyunhe G-Rath EvanHahn lithiumlron diego-codes
Deimos Calme1709 SterlingVix
Deimos Calme1709 SterlingVix

Important documents

stylelint-config-recommended-scss's People

Contributors

bryanjtc avatar chalkygames123 avatar dependabot[bot] avatar greenkeeper[bot] avatar hyzual avatar jeddy3 avatar jnoordsij avatar kristerkari avatar marclevine-8451 avatar niksy avatar phillip9587 avatar rchl avatar tom-ricci avatar xhmikosr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

stylelint-config-recommended-scss's Issues

Reset 'import-notation'

The combination of 'stylelint-config-standard' and 'stylelint-config-recommended-scss' leads to an interesting effect. The former contains this rule: 'import-notation': 'url'
That leads to import 'mixins.scss' > 'import url('mixins.scss')

Imports are resolved to url() imports which is interpreted by SCSS as plain CSS imports and that stops mixin/function/variable imports from working.

I suggest adding 'import-notation': null as we might have CSS imports next to SCSS imports.

An in-range update of eslint-config-stylelint is breaking the build 🚨

The devDependency eslint-config-stylelint was updated from 8.2.0 to 8.3.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

eslint-config-stylelint is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ continuous-integration/travis-ci/push: The Travis CI build failed (Details).

Release Notes for 8.3.0
  • Changed: eslint-plugin-jest rules to error
Commits

The new version differs by 3 commits.

  • 76293bf Prepare 8.3.0
  • c579256 Update CHANGELOG.md
  • c4a2e71 Switch eslint-plugin-jest rules from warn to error (#54)

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Unexpected unknown function "px-to-rem" scss/function-no-unknown

I defined a px-to-rem function, but an error will be reported when it is referenced in another style file.

// lib/css/px-to-rem.scss
@use 'sass:list';

$base-font-size: 16px;

@function px-to-rem($values...) {
  $rem-values: ();
  @each $value in $values {
    @if type-of($value) == number and unit($value) == 'px' {
      $rem-value: calc($value / $base-font-size) + rem;
      $rem-values: list.append($rem-values, $rem-value);
    } @else {
      $rem-values: list.append($rem-values, $value);
    }
  }
  @return $rem-values;
}

// other.scss
@import 'lib/css/px-to-rem';

.container {
  margin-bottom: px-to-rem(24px);
}

// Unexpected unknown function "px-to-rem"  scss/function-no-unknown

An in-range update of stylelint-scss is breaking the build 🚨

The devDependency stylelint-scss was updated from 3.3.2 to 3.4.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

stylelint-scss is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

Commits

The new version differs by 13 commits.

  • 8cb1656 Prepare version 3.4.0
  • baa0e66 Merge pull request #283 from kristerkari/bugfix/correctly-handle-parameters-in-partial-no-import
  • 2089d5f fix typo [ci skip]
  • e2f9e64 Add test
  • 17a5941 partial-no-import: correctly handle import parameters with urls
  • 885fefd Merge pull request #280 from niksy/at-mixin-argumentless-call-parentheses-fix
  • 4fdc378 Add "at-mixin-argumentless-call-parentheses" autofix
  • 921b294 Merge pull request #281 from kristerkari/feat/dependencies-bump
  • d298945 Update dependencies to latest versions
  • ec91b1c remove unused npm script
  • ad53965 Use eslint-plugin-lodash to avoid possible errors with Lodash
  • 2baa882 make contributor avatars bigger
  • f9650f8 Add a list of contributors

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

`annotation-no-unknown` should allow `!default`

Hi, thank you for maintaining this stylelint configuration, it is very helpful πŸ‘.

Since v14.10.0, stylelint added the annotation-no-unknown rule. Given that !default is a valid flag for Sass variables, I suggest to add some configuration to allow it. This way, users of this config will not have errors raised on their default Sass variables.

Before the change:

$my-variable: #ff0000 !default; // βœ–  Unexpected unknown annotation "!default"  annotation-no-unknown

After the change:

$my-variable: #ff0000 !default; // No error

What do you think about it ? I'll submit a PR for it shortly.

Fix postcss-scss module resolution when other postcss versions are present

Due to a bug with dependency resolution, when multiple versions of the postcss package are present, this config will fail to load postcss-scss. Normally this isn't an issue, but there are still cases where other postcss versions are needed (for example create-react-app 4 doesn't support postcss 8).

Based on stylelint/stylelint#5632 (comment), a fix should be made as such in index.js:

- customSyntax: 'postcss-scss',
+ customSyntax: require('postcss-scss'),

Eventually once the postcss community moves on from postcss 7, this should be okay to remove.

Deprecation warning with stylelint-scss 5.3.0 (5.2.1+?)

Hello,

I'm getting a deprecation warning after upgrading stylelint-scss to 5.3.0 something and I think (apologies if this is not the case, I'm not a javascript developer) it may be triggered by this library, which I'm using as a dependency of stylelint-config-twbs-bootstrap and stylelint-config-standard-scss

'scss/at-import-no-partial-leading-underscore': true,

Deprecation warnings:
 - The "scss/at-import-no-partial-leading-underscore" rule is deprecated.
 - 'at-import-no-partial-leading-underscore' has been deprecated, and will be removed in '6.0'. Use 'load-no-partial-leading-underscore' instead. See: https://github.com/stylelint-scss/stylelint-scss/blob/v5.2.1/src/rules/at-import-no-partial-leading-underscore/README.md

Ref: https://github.com/diowa/ruby3-rails7-bootstrap-heroku/actions/runs/6688272782/job/18170091224#step:6:13

Update: I'm seeing this deprecation message also on 5.2.1.

Deprecation warnings:
 - The "scss/at-import-no-partial-leading-underscore" rule is deprecated.
 - 'at-import-no-partial-leading-underscore' has been deprecated, and will be removed in '6.0'. Use 'load-no-partial-leading-underscore' instead. See: https://github.com/stylelint-scss/stylelint-scss/blob/v5.2.1/src/rules/at-import-no-partial-leading-underscore/README.md

Maintenance status?

Is this repo still maintained? There are lots of open pull requests that simply update important dependencies.

An in-range update of stylelint-scss is breaking the build 🚨

The devDependency stylelint-scss was updated from 3.4.0 to 3.4.1.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

stylelint-scss is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

Release Notes for 3.4.1
  • Fixed: at-function-named-arguments was not correctly handling functions inside Sass maps.
Commits

The new version differs by 8 commits.

  • 75bb4db Prepare version 3.4.1
  • 152dbae Merge pull request #290 from kristerkari/bugfix/at-function-named-arguments-functions-inside-sass-maps
  • 9127b1c Add more tests
  • 0fa5584 at-function-named-arguments: correctly parse functions inside Sass maps
  • 0c77143 Merge pull request #285 from kristerkari/feature/eslint-config-stylelint
  • 60d4e98 Use eslint-config-stylelint
  • 10b4ef2 run prettier
  • 830655f Update dev deps

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Version 10 of node.js has been released

Version 10 of Node.js (code name Dubnium) has been released! 🎊

To see what happens to your code in Node.js 10, Greenkeeper has created a branch with the following changes:

  • Added the new Node.js version to your .travis.yml

If you’re interested in upgrading this repo to Node.js 10, you can open a PR with these changes. Please note that this issue is just intended as a friendly reminder and the PR as a possible starting point for getting your code running on Node.js 10.

More information on this issue

Greenkeeper has checked the engines key in any package.json file, the .nvmrc file, and the .travis.yml file, if present.

  • engines was only updated if it defined a single version, not a range.
  • .nvmrc was updated to Node.js 10
  • .travis.yml was only changed if there was a root-level node_js that didn’t already include Node.js 10, such as node or lts/*. In this case, the new version was appended to the list. We didn’t touch job or matrix configurations because these tend to be quite specific and complex, and it’s difficult to infer what the intentions were.

For many simpler .travis.yml configurations, this PR should suffice as-is, but depending on what you’re doing it may require additional work or may not be applicable at all. We’re also aware that you may have good reasons to not update to Node.js 10, which is why this was sent as an issue and not a pull request. Feel free to delete it without comment, I’m a humble robot and won’t feel rejected πŸ€–


FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of stylelint is breaking the build 🚨

The devDependency stylelint was updated from 9.9.0 to 9.10.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

stylelint is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

Release Notes for 9.10.0
  • Added: support for ordinary regular expressions anywhere a regex string is accepted in rule config (#3799).
  • Added: css-in-js syntax option that will replace the existing styled and jsx ones (#3872).
  • Added: function-calc-no-invalid rule (#3833).
  • Added: ignore: ["next-sibling"] to selector-max-type (#3832).
  • Added: declaration-block-semicolon-space-after autofix (#3865).
  • Fixed: autofix is now disabled when a stylelint processors is used (#3873).
  • Fixed: CssSyntaxError for functions in template literals (#3869).
  • Fixed: no-descending-specificity false positives for styled-components (#3875).
  • Fixed: no-duplicate-selectors false positives for styled-components (#3875).
  • Fixed: selector-pseudo-class-no-unknown false positives for focus-visible (#3887).
  • Fixed: selector-max-universal false positives for flush comments containing a comma (#3817).
  • Fixed: shorthand-property-redundant-values false positives for negative values (#3888).
Commits

The new version differs by 41 commits.

  • af6c857 Prepare 9.10.0
  • 1d01ec2 Prepare changelog
  • cb8f56a Update CHANGELOG.md
  • afb49fc Don't report "unknown pseudo class" for :focus-visible (#3886) (#3887)
  • bf989e9 Update CHANGELOG.md
  • 6ddc90b Allow negative values for shorthand-property-redudant-values (#3840) (#3888)
  • 387bda2 Update globby (#3890)
  • e4e758d Fix tests to account for new syntax errors in PostCSS (#3892)
  • 4e7f263 Update url of stylelint-webpack-plugin (#3883)
  • 94dbb4e Update flow-bin to the latest version πŸš€ (#3881)
  • 3495702 Update CHANGELOG.md
  • e57e893 Run rules for each root of document (#3875)
  • 762df47 Update CHANGELOG.md
  • 584876d Fix false positives for flush comments containing a comma in selector-max-universal (#3817)
  • 754bf92 Update CHANGELOG.md

There are 41 commits in total.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Stylelint ^10.0.0 support

With the latest release of stylelint 10.0.0, a missing peer dependency warning is thrown as only ^8.0.0 || ^9.0.0 are listed as peer dependencies.

An in-range update of eslint is breaking the build 🚨

The devDependency eslint was updated from 5.15.3 to 5.16.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

eslint is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

Release Notes for v5.16.0
  • dfef227 Build: gensite passes rulesMeta to formatter rendering (#11567) (Kevin Partington)
  • c06d38c Fix: Allow HTML formatter to handle no meta data (#11566) (Ilya Volodin)
  • 87a5c03 Docs: func-style: clarify when allowArrowFunctions is used (#11548) (Oliver Joseph Ash)
  • bc3e427 Update: pass rule meta to formatters RFC 10 (#11551) (Chris Meyer)
  • b452f27 Chore: Update README to pull in reviewer data (#11506) (Nicholas C. Zakas)
  • afe3d25 Upgrade: Bump js-yaml dependency to fix Denial of Service vulnerability (#11550) (Vernon de Goede)
  • 4fe7eb7 Chore: use nyc instead of istanbul (#11532) (Toru Nagashima)
  • f16af43 Chore: fix formatters/table test (#11534) (Toru Nagashima)
  • 78358a8 Docs: fix duplicate punctuation in CLI docs (#11528) (Teddy Katz)
Commits

The new version differs by 11 commits.

  • ded2f94 5.16.0
  • ea36e13 Build: changelog update for 5.16.0
  • dfef227 Build: gensite passes rulesMeta to formatter rendering (#11567)
  • c06d38c Fix: Allow HTML formatter to handle no meta data (#11566)
  • 87a5c03 Docs: func-style: clarify when allowArrowFunctions is used (#11548)
  • bc3e427 Update: pass rule meta to formatters RFC 10 (#11551)
  • b452f27 Chore: Update README to pull in reviewer data (#11506)
  • afe3d25 Upgrade: Bump js-yaml dependency to fix Denial of Service vulnerability (#11550)
  • 4fe7eb7 Chore: use nyc instead of istanbul (#11532)
  • f16af43 Chore: fix formatters/table test (#11534)
  • 78358a8 Docs: fix duplicate punctuation in CLI docs (#11528)

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

stylelint-config-recommended-scss "doesn't provide postcss, requested by postcss-scss"

with

yarn --version
	3.2.0-rc.8

yarn info --name-only| egrep "postcss@|postcss-scss|stylelint-config"
	β”œβ”€ postcss@npm:8.4.5
	β”œβ”€ postcss-scss@npm:4.0.2
	β”œβ”€ stylelint-config-standard-scss@npm:3.0.0

and yarn exec reports,

yarn
	➀ YN0000: β”Œ Resolution step
???	➀ YN0002: β”‚ stylelint-config-recommended-scss@npm:5.0.2 [577f4] doesn't provide postcss (p9d028), requested by postcss-scss
	➀ YN0000: β”‚ Some peer dependencies are incorrectly met; run yarn explain peer-requirements <hash> for details, where <hash> is the six-letter p-prefixed code
	➀ YN0000: β”” Completed
	➀ YN0000: β”Œ Fetch step
	➀ YN0000: β”” Completed in 0s 210ms
	➀ YN0000: β”Œ Link step
	➀ YN0000: β”‚ ESM support for PnP uses the experimental loader API and is therefore experimental
	➀ YN0000: β”” Completed
	➀ YN0000: Done with warnings in 0s 498ms

where

yarn explain peer-requirements p9d028
	➀ YN0000: stylelint-config-recommended-scss@npm:5.0.2 [577f4] doesn't provide postcss, breaking the following requirements:

	➀ YN0000: postcss-scss@npm:4.0.2 [54149] β†’ ^8.3.3 ✘

is this a fix needed in s-c-r-s? postcss*? or local config?

Various deprecation warning after upgrading stylelint to 15.0.0

After upgrading stylelint to 15.0.0 the following deprecation warnings appear:

 - The "block-closing-brace-space-before" rule is deprecated.
 - The "block-opening-brace-space-after" rule is deprecated.
 - The "color-hex-case" rule is deprecated.
 - The "max-empty-lines" rule is deprecated.
 - The "no-empty-first-line" rule is deprecated.
 - The "no-extra-semicolons" rule is deprecated.
 - The "selector-list-comma-newline-after" rule is deprecated.

Could these rules be removed?
Thanks!
mario

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.