0.0.0 • Published 7 years ago
stylelint-processor-name-to-vscode-language-ids v0.0.0
stylelint-warning-to-vscode-diagnostic
Convert a stylelint warning into a Visual Studio Code diagnostic
const {lint} = require('stylelint');
const stylelintWarningToVscodeDiagnostic = require('stylelint-warning-to-vscode-diagnostic');
async () => {
const {results: [{warnings}]} = await lint({
code: 'a { color: red; }',
config: {
rules: {
'color-named': 'never'
}
}
});
warnings[0];
/* {
rule: 'color-named',
text: 'Unexpected named color "red" (color-named)',
severity: 'error',
line: 1,
column: 12
} */
stylelintWarningToVscodeDiagnostic(warnings[0]);
/* {
message: 'Unexpected named color "red" (color-named)',
severity: 1,
source: 'stylelint',
range: {
start: {
line: 0,
character: 11
},
end: {
line: 0,
character: 11
}
}
} */
};
Installation
npm install stylelint-warning-to-vscode-diagnostic
API
const stylelintWarningToVscodeDiagnostic = require('stylelint-warning-to-vscode-diagnostic');
stylelintWarningToVscodeDiagnostic(warning)
warning: Object
(stylelint warning)
Return: Object
(VS Code diagnostic)
License
Copyright (c) 2017 Shinnosuke Watanabe
Licensed under the MIT License.
0.0.0
7 years ago