Search code examples
node.jsnpmstylelint

How to check css syntastic error with styleline?


To install styleline with npm.

sudo npm install -g stylelint

To install config file for stylelint.

sudo npm install stylelint-config-standard --save-dev -g 
npm WARN [email protected] requires a peer of stylelint@^7.8.0 but none was installed.

+ [email protected]
added 1 package in 1.017s

Now to check a test.css file with stylelint.

$ stylelint   "/tmp/menu/test.css"  
Error: No configuration provided for /tmp/menu/test.css
    at module.exports (/usr/lib/node_modules/stylelint/lib/utils/configurationError.js:8:27)
    at stylelint._fullExplorer.load.then.then.config (/usr/lib/node_modules/stylelint/lib/getConfigForFile.js:39:13)
    at <anonymous>

Why the issue arise --No configuration provided for /tmp/menu/test.css?
How to fix it?


Solution

  • In according to stylelint configuration document. You need to set your configuration object.

    https://github.com/stylelint/stylelint/blob/master/docs/user-guide/configuration.md