Skip to content

This is almost a copy of eslint-plugin-filename-rules. It only adds support for JSON Regex Expressions

License

Notifications You must be signed in to change notification settings

brandonbrown5/eslint-plugin-filename-rules-with-json-support

 
 

Repository files navigation

eslint-plugin-filename-rules

Adds an ESLint rule to enforce filename conventions for linted files. Allows different options for different file extensions. Supports custom regular expressions.

NPM Version NPM Downloads Build Status Coverage Status License: MIT

Installation

$ npm install -D eslint-plugin-filename-rules

Add it to your .eslintrc.js:

module.exports = {
  plugins: [
    'filename-rules',
  ],
  rules: {
    'filename-rules/match': [2, 'camelcase'],
  },
};

Plugin Options

The following built-in values are supported: pascalcase/PascalCase, camelcase/camelCase, snakecase/snake_case, kebabcase/kebab-case. You can also provide your own regex:

...
'filename-rules/match': [2, /^([a-z]+-)*[a-z]+(?:\..*)?$/],
...

You can also specify different options for different file extensions. In this case the plugin will only check files with extensions you explicitly provided:

...
'filename-rules/match': [2, { '.js': 'camelCase', '.ts': /^([a-z]+-)*[a-z]+(?:\..*)?$/ }],
...

To use in eslint.json file, you can specify the regex expressions as strings

...
"filename-rules/match": [2, "/^([a-z]+-)*[a-z]+(?:\..*)?$/"]
...

License

MIT

About

This is almost a copy of eslint-plugin-filename-rules. It only adds support for JSON Regex Expressions

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%