check-case-webpack-plugin
TypeScript icon, indicating that this package has built-in type declarations

0.1.1 • Public • Published

About

We should standard file case type to avoid sensitive case problem.

Uppercase case is not recommended, we encourage use snake or kebab case.

Output

e.g. components/Pascal/file.tsx

After using kebab case type of this plugin will output

[CheckCaseWebpackPlugin] src/components/Pascal/file.tsx does not respect kebab rule.

Install

npm i check-case-webpack-plugin

Usage

const { CheckCaseWebpackPlugin } = require('check-case-webpack-plugin');

const webpackConfig = {
  // context: 'your project path absolute path' // recommend define context.
  plugins: [
    new CheckCaseWebpackPlugin({})
    // other plugins ...
  ]
  // other webpack config ...
};

Plugin API

type ValidCaseType = 'kebab' | 'snake';

type CheckInfoType = 'warn' | 'error' | 'none';

interface ICaseCheckOptions {
  caseType: ValidCaseType;
  checkInfoType?: CheckInfoType;
  exclude?: Array<RegExp>;
}
  • caseType

    Choose case type you like.It's a required option.

    • 'kebab' e.g. kebab-case
    • 'snake' e.g. snake_case
  • checkInfoType

    Choose info level you like. Default is error.

    • 'error' output webpack errors
    • 'warn' output webpack warnings
    • 'none' never output anything
  • exclude There ara some files you don't want to check, such as files in node_modules. Default is `[/node_modules/]

Notice

Recomend define context in webpack.config.js as check path will check webpack cwd path, if not some extra path will be checked.

Dependencies (0)

    Dev Dependencies (19)

    Package Sidebar

    Install

    npm i check-case-webpack-plugin

    Weekly Downloads

    15

    Version

    0.1.1

    License

    MIT

    Unpacked Size

    16 kB

    Total Files

    10

    Last publish

    Collaborators

    • zhangwilling