19.3.3 • Published 6 months ago

@lucca/stylelint-config-prisme v19.3.3

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

lucca-prisme / Stylelint config

This package is a shareable stylelint configuration.

Stylelint checks for common mistakes in CSS and CSS-like files, and allows to define rules for tools and developers.

Prettier should be used to handle coding style-guides when possible.

  • This configuration lints your code with default CSS & SCSS rules, and adapts some of them for Lucca Front specifics
  • It will trigger warnings for deprecated LF features and errors for deleted LF features.

Install

npm i --save-dev stylelint @lucca/stylelint-config-prisme

Avoid conflicts

Remove any pre-existing configuration (file or statements in package.json).

Configure

For your local project

Use this package in a stylelint.config.js file in your repository:

module.exports = {
  extends: ['@lucca/stylelint-config-prisme'],
  rules: {},
};

For your CI

Add the relevant script to lint the code in Jenkins.

"stylelint": "stylelint \"./**/*.scss\"",

You can be more specific and restrict the path of scss files being linted: "stylelint": "stylelint \"./SOME_PATH/**/*.scss\"",

showCachePath parameter

To avoid hitting Github’s rate limit, the script caches Milestones versions in a local file. Knowing which file has been created can be useful, but also hard to find.

Webstorm has an issue with outputting the information during the linting, so outputting the path is optional with a parameter:

npx stylelint \"./**/*.scss\" showCachePath

Breaking the rules

Overrides

You can apply specific rules with overrides as needed.

Rules can be disabled while incrementally fixing your code. Set them to null. The following example will ignore the no-descending-specificity rule in all SCSS files within `some-path :

module.exports = {
 extends: ['@lucca/stylelint-config-prisme'],
 overrides: [
  {
   files: ['some-path/**/*.scss'],
   rules: {
    'no-descending-specificity': null,
   }
  },
 ],
 rules: {};
};

Ignoring code inline

If needed, each rule can be ignored with stylelint-(dis|en)able.

Please explain why with a comment if you're doing so. Use styleling-disable[-*] -- Comment and enable stylelint back as soon as possible: styleling-enable.

Testing locally

  1. From the root of this package, run npm pack. This will generate a .tgz file.
  2. From the root of the project you want to lint, run npm i PATH_TO_LUCCA_FRONT_REPOSITORY/packages/stylelint-config/lucca-front-stylelint-config-0.0.0.tgz.

The configuration from your local repository should be applied right away. If in doubt, restart your editor.

Configuring your editor

VS Code

⚠️ A VSCode extension bug might prevent you from using stylelint 16+. See below for a fix through VS-code settings.

Those settings in .vscode/settings.json should be fine, but you can also follow instructions on the extension page: :

  "[scss]": {
    "editor.formatOnSave": true,
    "editor.defaultFormatter": "stylelint.vscode-stylelint",
    "editor.codeActionsOnSave": {
      "source.fixAll.stylelint": "explicit"
    }
  },
  "stylelint.reportInvalidScopeDisables": true,
  "stylelint.reportNeedlessDisables": true,
  "stylelint.snippet": ["css", "scss"],
  "stylelint.validate": ["css", "scss"],

Please note the VSCode extension does not take overrides into account.

bug: double slash comments appended to the nearest property

A hackfix is available.

Add the following line in .vscode/settings.json if the issue arises:

  "stylelint.customSyntax": "postcss-scss"

WebStorm

You might need to rename stylelint.config.js to stylelint.config.cjs (CommonJS) and adapt the code in consequence.

In Stylelint settings, make sure Run for files is for SCSS files (**/*.{scss}). It is only for CSS files by default (**/*.{css}).

19.3.3

6 months ago

19.3.3-rc.7

6 months ago

19.3.3-rc.6

6 months ago

19.3.3-rc.4

6 months ago

19.3.3-rc.3

6 months ago

19.3.3-rc.2

6 months ago

19.3.3-rc.1

7 months ago

19.3.2

7 months ago

19.3.2-rc.1

7 months ago

19.3.1

7 months ago

19.3.1-rc.2

7 months ago

19.3.1-rc.1

7 months ago

19.3.0

8 months ago

19.3.0-rc.4

8 months ago

19.2.1

9 months ago

19.2.0

10 months ago