AtomLinter / linter-stylelint

A plugin for Atom Linter providing an interface to stylelint.

Home Page:https://atom.io/packages/linter-stylelint

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How can I get "Possible Errors" to show up as errors and "Stylistic Issues" to show up as warnings?

unknowledgeable opened this issue · comments

Apologies if this is all very simple stuff but I'm new to all of this and feel like I'm poking around in the dark.

I'm trying to get linter-stylelint to show warnings for any "Stylistic Issues" and errors for any "Possible Errors".

As I understand it, it's best practice to have a .stylelintrc file in the root folder of the project that contains any modifications you want to make to stylelint-config-standard but I've also seen that there's a config called stylelint-config-recommended that only displays "Possible Errors".

How would I go about using these resourses to create a .stylelintrc file that essentially has:

  • stylelint-config-recommended rules show up as errors
  • anything else in stylelint-config-standard to show up as warnings

I've had a read through some of the solutions to this issue and the stylelint.io documentation but I'm still struggling to figure out which files are where, whether I need to create a new file or whether there's one I could be editing.

Many thanks

I think I've gotten somewhere with this and to be clear this isn't for a production environment, I'm in the process of learning CSS and I want to know the severity of my mistakes and whether they will or won't break the code.

Is what I'm after achieved by checking "Use standard" in the Settings and then creating a .stylelintrc file in the root of the project with just this inside?


{
  extends: "stylelint-config-standard",
  defaultSeverity: "warning",
  rules: {
    "color-no-invalid-hex": [ true, { severity: "error" } ],
    "font-family-no-duplicate-names": [ true, { severity: "error" } ],
    "font-family-no-missing-generic-family-keyword": [ true, { severity: "error" } ],
    "function-calc-no-invalid": [ true, { severity: "error" } ],
    "function-calc-no-unspaced-operator": [ true, { severity: "error" } ],
    "function-linear-gradient-no-nonstandard-direction": [ true, { severity: "error" } ],
    "string-no-newline": [ true, { severity: "error" } ],
    "unit-no-unknown": [ true, { severity: "error" } ],
    "property-no-unknown": [ true, { severity: "error" } ],
    "keyframe-declaration-no-important": [ true, { severity: "error" } ],
    "declaration-block-no-duplicate-properties": [ true, { severity: "error" } ],
    "declaration-block-no-shorthand-property-overrides": [ true, { severity: "error" } ],
    "block-no-empty": [ true, { severity: "error" } ],
    "selector-pseudo-class-no-unknown": [ true, { severity: "error" } ],
    "selector-pseudo-element-no-unknown": [ true, { severity: "error" } ],
    "selector-type-no-unknown": [ true, { severity: "error" } ],
    "media-feature-name-no-unknown": [ true, { severity: "error" } ],
    "at-rule-no-unknown": [ true, { severity: "error" } ],
    "comment-no-empty": [ true, { severity: "error" } ],
    "no-descending-specificity": [ true, { severity: "error" } ],
    "no-duplicate-at-import-rules": [ true, { severity: "error" } ],
    "no-duplicate-selectors": [ true, { severity: "error" } ],
    "no-empty-source": [ true, { severity: "error" } ],
    "no-extra-semicolons": [ true, { severity: "error" } ],
    "no-invalid-double-slash-comments": [ true, { severity: "error" } ],
  }
}

Is this the full list of "Possible Errors"?

Since you have a configuration file the "Use Standard" option will be ignored, as it's only for linting CSS that doesn't have any stylelint configuration associated with it.

It looks like what you have posted will work, but this is a question better asked over at stylelint if their documentation and your own experimentation don't end up with what you are looking for. This project is just a wrapper around stylelint 😉.

Ah I see, thanks very much! I've set it to "disable when no config is found" for now then.