eslint-plugin-nada

enforces folder and file names to match desired case style

Usage no npm install needed!

<script type="module">
  import eslintPluginNada from 'https://cdn.skypack.dev/eslint-plugin-nada';
</script>

README

eslint-plugin-nada

Enforces full path, folder and file names to match desired case style

  • Quick example:
// Errors for rule: kebabCase
myFileFolder/my-file-name.js // file path

// Ok for rule: kebabCase
my-file-folder/my-file-name.js // file path

Installation

You'll first need to install ESLint:

$ npm i eslint --save-dev

Next, install eslint-plugin-nada:

$ npm install eslint-plugin-nada --save-dev

Note: If you installed ESLint globally (using the -g flag) then you must also install eslint-plugin-nada globally.

Usage

Add nada to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:

{
  "plugins": [
    "nada"
  ]
}

Then configure the rules you want to use under the rules section.

First param is the severity level as per eslint standards, where: 0 = off, 1 = warn, 2 = error

{
  "rules": {
    "nada/path-case": [2, {"case": "kebabCase"}]
  }
}

Supported Rules

path-case

Enforces full path, folder and file names to match desired case style.

Options

  • case: Supported case options are: kebabCase, camelCase and snakeCase.

Example:

{
  "rules": {
    "nada/path-case": [{"case": "kebabCase"}]
  }
}
  • ignoreParts: Array of strings to be ignored. Useful if you use file names like my-file.spec.js or my-file.test.js.

Example:

{
  "rules": {
    "nada/path-case": [
      {
        "case": "kebabCase",
        "ignoreParts": [".test", ".spec"]},
    ]
  }
}

Contributing

Roadmap

  • auto fix by renaming the file path to match desired rule
  • maybe Typescript