Nighttime Peanut Migrations
Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

@startingpoint/stylint-webpack-plugin

0.2.6 • Public • Published

@startingpoint/stylint-webpack-plugin

Webpack loader plugin for stylint (linter of stylus files)

Install

Install the stylint

npm i stylint -D

Install @startingpoint/stylint-webpack-plugin package

npm i @startingpoint/stylint-webpack-plugin -D

or

yarn add --dev @startingpoint/stylint-webpack-plugin

If you want to use a custom reporter for a stylint, you also need to install it. For example:

npm i stylint-stylish -D

This webpack plugin for stylint, which supports specifying a directory or several directories of your project with a stylus files. Those files will pass through the linter stylint. By default, lint will use the .stylintrc file in the project root if present. But you can configure it in the options. This plugin supports .styl and .vue files.

Usage

In webpack config:

const StylintWebpackPlugin = require('@startingpoint/stylint-webpack-plugin');

plugins: [
    new StylintWebpackPlugin({
        files: './app/blocks',
        reporter: 'stylint-stylish',
        reporterOptions: {verbose: true}
    })
]

In nuxt config:

const StylintWebpackPlugin = require('@startingpoint/stylint-webpack-plugin');
export default {
    ...,

    build: {
        extend (config, ctx) {
            if (ctx.isDev && ctx.isClient) {
                config.plugins.push(new StylintWebpackPlugin({
                    files: ['./pages', './assets'],
                }));
            }
        },
    },

    ...,
}

Options

Name Type Default Description
files [String,Array] ./ Stylus files directory or several directories, who need to check
config [String] undefined Pass in path to custom rules configuration file as a string. If no configuration is passed in, it will use the .stylintrc file in the project root if present. If that file is not present, it will use default stylint rules.
rules [Object] undefined Pass in an object with rules for stylint to lint by. This will override all default rules
exclude [RegExp] /node_modules/ Regex for ignores files or sub-directories matching pattern
reporter [String] undefined If you want to use a custom reporter, you can pass in either a string with it's name
reporterOptions [Object] undefined Options for your custom reporter

Install

npm i @startingpoint/stylint-webpack-plugin

DownloadsWeekly Downloads

1

Version

0.2.6

License

MIT

Unpacked Size

6.29 kB

Total Files

4

Last publish

Collaborators

  • avatar