Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including stylelint-processor-name-to-vscode-language-ids with all npm packages installed. Try it out:

var stylelintProcessorNameToVscodeLanguageIds = require("stylelint-processor-name-to-vscode-language-ids")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

stylelint-processor-name-to-vscode-language-ids v0.0.0

Return an ID of the VS Code language mode that a given stylelint processor supports

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 {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

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

Copyright (c) 2017 Shinnosuke Watanabe

Licensed under the MIT License.

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free