Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

eslint-plugin-snakecasejs

1.2.1 • Public • Published

ESLint Plugin snakecasejs

What does it do

This is to enforce a style of snake_case in your project, rather than just disabling camelCase.

Features

  • [✓] Easy to use
  • [✓] MIT License
  • [✓] Compatible with latest version of ESLint
  • [✓] Compatible with CamelCase (Class name or similar)
  • [✓] Compatible with --fix (convert automatically camelCase to snake_case)
  • [✓] White list array for methods or variables with camelCase syntax from other libraries/npm package.

Fast setup

  1. Install eslint: npm install eslint --save-dev
  2. Install snakecasejs plugin: npm install eslint-plugin-snakecasejs --save-dev
  3. Create .eslintrc.json file with:
{
    "plugins": [
        "snakecasejs"
    ],
    "rules":
    {
        "snakecasejs/snakecasejs": "error",
        "snakecasejs/whitelist": []
    }
}
  1. If it works add a star ⭐️ at this project ❤️
  2. If you want to help me: donate on paypal or become a backer on patreon.

NOTE: switch error to warn if you don't need snake_case as mandatory rules.

For advanced configuration see INSTALL.md.

--fix

This eslint parameter fix simple rules of linter and with this plugin convert all camelCase variables or function name to snake_case. Fix command support whitelist. Run this command in your project directory:

  • eslint ./ --cache --ignore-pattern .gitignore --fix

WARNING: You need install eslint globally for this feature: npm install eslint -g

White list

Ignore words, variables, methods, class name without snake_case syntax. Add rules: "snakecasejs/whitelist": [] with array of variables or method with camelCase that you can not convert to snake_case (external library naming convention).

Plugin ignore check on this words. Example: "snakecasejs/whitelist": ["externalPath","setNumber"]

License

MIT LICENSE

Copyright (c) 2018 Patryk Rzucidło (PTKDev)

install

npm i eslint-plugin-snakecasejs

Downloadsweekly downloads

77

version

1.2.1

license

MIT

homepage

ptkdev.io

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability