Not Pictured: Mangoes

    This package has been deprecated

    Author message:

    This package is deprecated, see https://github.com/stylelint/vscode-stylelint for upcoming new release

    stylelint-warning-to-vscode-diagnostic

    1.0.1 • Public • Published

    stylelint-warning-to-vscode-diagnostic

    npm version Build Status Coverage Status

    Convert a stylelint warning into a Visual Studio Code diagnostic

    const {lint} = require('stylelint');
    const stylelintWarningToVscodeDiagnostic = require('stylelint-warning-to-vscode-diagnostic');
     
    (async () => {
      const [result] = await lint({
        code: 'a { color: red; }',
        config: {
          rules: {
            'color-named': 'never'
          }
        }
      });
     
      const [warning] = result.warnings;
      /* {
        rule: 'color-named',
        text: 'Unexpected named color "red" (color-named)',
        severity: 'error',
        line: 1,
        column: 12
      } */
     
      stylelintWarningToVscodeDiagnostic(warnings);
      /* {
        message: 'Unexpected named color "red" (color-named)',
        severity: 1,
        source: 'stylelint',
        range: {
          start: {
            line: 0,
            character: 11
          },
          end: {
            line: 0,
            character: 11
          }
        }
      } */
    })();

    Installation

    Use npm.

    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

    ISC License © 2018 Shinnosuke Watanabe

    Install

    npm i stylelint-warning-to-vscode-diagnostic

    DownloadsWeekly Downloads

    4

    Version

    1.0.1

    License

    ISC

    Unpacked Size

    5.7 kB

    Total Files

    4

    Last publish

    Collaborators

    • ntwb