Skip to content

ptkdev/eslint-plugin-snakecasejs

This branch is 29 commits ahead of deecewan/eslint-plugin-snakecase:master.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

b469a0e ยท Dec 31, 2019

History

32 Commits
Jul 4, 2019
Nov 29, 2019
Jul 4, 2019
Jul 4, 2019
Jul 4, 2019
Aug 10, 2019
Jul 4, 2019
Jul 4, 2019
Dec 31, 2019
Aug 10, 2019
Dec 31, 2019
Dec 4, 2019
Dec 31, 2019
Dec 31, 2019

Repository files navigation

ESLint Plugin: snakecasejs

๐Ÿ ESLint Plugin: snakecasejs

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

๐ŸŽ Support: Donate

This project is free, open source and I try to provide excellent free support. Why donate? I work on this project several hours in my spare time and try to keep it up to date and working. THANK YOU!

๐Ÿ“Ž Menu

๐Ÿ’ก 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"
    ],
    "settings":
    {
        "snakecasejs/filter": ["ClassDeclaration", "NewExpression"],
        "snakecasejs/whitelist": ["externalPath", "setNumber"]
    },
    "rules":
    {
        "snakecasejs/snakecasejs": "error"
    }
}
  1. If it works add a star ๐ŸŒŸ at this project โค๏ธ
  2. If you want to help me: donate on paypal/ko-fi or become a backer on patreon.

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

๐Ÿ”ง --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 variables, methods, etc... without snake_case syntax. Add to settings: "snakecasejs/whitelist": ["NewPageClass"] with array of variables with camelCase that you can not convert to snake_case (example: for external library naming convention).

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

๐Ÿšฌ Filter

Ignore global checks for class declarations, all methods, etc... Add to settings: "snakecasejs/filter": [] with array of eslint expression or declaration, default value: ["ClassDeclaration", "NewExpression"] for better compatibility with camel case class.

๐Ÿ“š Documentation

Run npm run docs

๐Ÿ‘‘ Sponsors

Support this project by becoming a sponsor. ๐Ÿ™ Become a sponsor on patreon or become top3 sponsor on ko-fi. Your logo will show up here with a link to your website.

๐Ÿฆ„ Backers

Thank you to all our backers! ๐Ÿ™ Become a backer on patreon.

โค๏ธ Contributing

I ๐Ÿ’Ÿ contributions! I will happily accept your pull request! Translations, grammatical corrections (GrammarNazi you are welcome! Yes my English is bad, sorry), etc... Do not be afraid, if the code is not perfect we will work together ๐Ÿ‘ฏ and remember to insert your name in .all-contributorsrc and package.json file.

Thanks goes to these wonderful people (emoji key):


Patryk Rzucidล‚o

๐Ÿ’ป

David Buchan-Swanson

๐Ÿ’ป

Tomasz Domaล„ski

๐Ÿ’ป

๐Ÿ’ฐ In the future, if the donations allow it, I would like to share some of the success with those who helped me the most. For me open source is share of code, share development knowledges and share donations!

๐Ÿ“ฒ Tools

๐Ÿ’ซ License

  • Code and Contributions have MIT License
  • Images and logos have CC BY-NC 4.0 License (Freepik Premium License)
  • Documentations and Translations have CC BY 4.0 License
Copyleft (c) 2018-2019 Patryk Rzucidล‚o (@PTKDev) <support@ptkdev.io>