0

I am really sorry for this newbie question but I can't see how solve that...

I installed linter-stylelint and tried to configure it like it's said there: https://atom.io/packages/linter-stylelint

So: - I placed a stylelint.config.js file in my project. - In the settings, I checked Use standard - But can't see what I have to do to "Add a stylelint section in your package.json"

On my Mac I see the file: /Users/eric/node_modules/stylelint-config-standard But I don't know what code do I have to insert inside...

By the way, when I try to use linter-stylelint in a css file I get the error message: Unable to parse stylelint configuration Unexpected token :

In my stylelint.config.js, I have the following code for now:

{
"extends": "stylelint-config-standard"
  "rules" {
    "no-unsupported-browser-features": [ true, { "severity": "warning" }]
   }
}

Thanks if you can help me! ;)

Paul

Monsieur Paul
  • 91
  • 1
  • 4

1 Answers1

0

So: - I placed a stylelint.config.js file in my project. - In the settings, I checked Use standard

According to the docs you reference, you should either place a stylelint.config.js file or check "Use standard".

I get the error message Unable to parse stylelint configuration Unexpected token :

This is because the JSON of your configuration file is invalid. It is missing both a comma and a colon. Use a service like JSONLint to validate JSON. Your fixed config is:

{
    "extends": "stylelint-config-standard",
    "rules": {
        "no-unsupported-browser-features": [true, {
            "severity": "warning"
        }]
    }
}

Even though this config is valid JSON, it won't work because the no-unsupported-browser-features rule is no longer built into stylelint. It is, however, available as a plugin. You'll need to follow the plugin's instructions if you wish to use it.

I am really sorry for this newbie question

It's fine. We are all newbies in the beginning! As you're just getting started with stylelint, I suggest you remove the stylelint.config.js file and ensure the "Use Standard" box is checked. This is likely the quickest way to get going. Once you are more comfortable with the tool, you can investigate creating your own configuration file for your specific needs.

jeddy3
  • 3,451
  • 1
  • 12
  • 21
  • Thanks! Now I can: - use standard csslint - use extended with this code //.stylelintrc { "extends": "/Users/eric/node_modules/stylelint-config-standard", "plugins": [ "/Users/eric/node_modules/stylelint-no-unsupported-browser-features" ], "rules": { "plugin/no-unsupported-browser-features": [true, { "severity": "warning" }] } } But few Errors became Warnings… - How could I configure .stylelintrc to mark « minor stylistic » errors as warnings? - Any tool to format stylesheets for the « minor stylistic » errors? – Monsieur Paul Mar 24 '18 at 10:22
  • pfff... unable to format code... `code`//.stylelintrc { "extends": "/Users/eric/node_modules/stylelint-config-standard", "plugins": [ "/Users/eric/node_modules/stylelint-no-unsupported-browser-features" ], "rules": { "plugin/no-unsupported-browser-features": [true, { "severity": "warning" }] } } – Monsieur Paul Mar 24 '18 at 10:30