UNPKG

@bootcamp-project/eslinttier

Version:

Ready-to-use ESLint & Prettier Configuration with best practice settings by default

244 lines (191 loc) 11.2 kB
<!-- MIT License Copyright (c) 2021 Bootcamp-Project contributors <contributors@bootcamp-project.com> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --> <a href="https://bootcamp-project.com/" target="_blank"><img src="https://bootcamp-project.com/tbcp.svg" align="right" height="200" /></a> # Ready-to-use ESLint & Prettier Configuration ## with best practice settings by default <img src="https://img.shields.io/npm/v/@bootcamp-project/eslinttier?style=for-the-badge"> <img src="https://img.shields.io/npm/types/@bootcamp-project/eslinttier?style=for-the-badge"> <img src="https://img.shields.io/librariesio/release/npm/@bootcamp-project/eslinttier?style=for-the-badge"> <img src="https://img.shields.io/gitlab/pipeline-status/the-bootcamp-project/configurations/eslint?branch=main&style=for-the-badge"> <img src="https://img.shields.io/npm/dm/@bootcamp-project/eslinttier?style=for-the-badge"> <img src="https://img.shields.io/badge/License-MIT-lightgrey?style=for-the-badge" /> <img src="https://img.shields.io/badge/Bootcamp-Project-blue?style=for-the-badge" /> ## 🦄 About 🦄 **Minimum Viable Product**: *What is what we want?* > *The creation and deployment of a centralized sharable configuration, with the most well-known best practice approaches.* - **What are the goals?** - [X] Automation of publishing, testing, linting and packaging with GitLab-CI - [X] Provide understandable documentation for the use of the configuration - [X] Test the return of the configuration with unit tests and the validation of the configuration structure with smoke tests. - [X] For the greatest possible compatibility we provide TypeScript definitions - [X] Use the unified [ESLint and Prettier configuration][RTFM_ESLintPrettier] for static analysis of the source code - [X] Choose the known best practices to configure ESLint and Prettier so that the source code is uniformly and security-consciously linted ## 🚀 Getting Started 🚀 **Project Links** - [Homepage][Project_Homepage] - [Documentation][Project_Docs] - [Repository][Repo_URL] - [Issues][Repo_Issues] ### 💪 Installation 💪 ```bash yarn add @bootcamp-project/eslinttier ``` **or** ```bash npm install @bootcamp-project/eslinttier ``` ### 🤩 Usage 🤩 > See [@bootcamp-project/eslinttier preselections][Project_Config] #### Best practice ESLint & Prettier Config Example ```js // .eslintrc.js 'use strict'; const ESLintConfig = require('@bootcamp-project/eslinttier').ESLintConfig module.exports = ESLintConfig ``` **If you want more...** ```js // .eslintrc.js 'use strict'; const ESLintConfig = require('@bootcamp-project/eslinttier').ESLintConfig module.exports = { ...ESLintConfig, // Takes the TBCP base settings // ... // Place to specify ESLint settings. Can be used to overwrite rules specified from the extended configs // ... rules: { // e.g. "no-secrets/no-secrets": "error", 'no-secrets/no-secrets': 'error', 'pii/no-email': 'error', 'pii/no-dob': 'warn', 'pii/no-ip': 'error', 'pii/no-phone-number': 'error' } } ``` #### Prettier Config Example ```js // .prettierrc.js 'use strict'; const PrettierConfig = require('@bootcamp-project/eslinttier').PrettierConfig module.exports = PrettierConfig ``` **If you want more...** ```js // .prettierrc.js 'use strict'; const PrettierConfig = require('@bootcamp-project/eslinttier').PrettierConfig module.exports = { ...PrettierConfig, // Takes the TBCP base settings // ... // add your own Prettier settings here // ... } ``` ## ⭐️ Features ⭐️ - TypeScript definitions (**@types**) included - [**Smoke** and **Unit-tested**][Repo_Tests] modules - Latest **Dependencies** preinstalled *Batteries included!* - Security-first production-ready [**configurations**][TBCP_Configurations] by default - Extensive [**documentation**][Project_Docs] ### 😎 Built With 😎 <table> <tr> <td><a href="https://eslint.org/" target="_blank"><img src="https://cdr.rtfm.page/logos/programming/eslint.svg" alt="ESLint" width="200"/></a></td> <td><a href="https://prettier.io/" target="_blank"><img src="https://cdr.rtfm.page/logos/programming/prettier.svg" alt="Prettier" width="200"/></a></td> <td><a href="https://developer.mozilla.org/" target="_blank"><img src="https://cdr.bootcamp-project.com/logos/programming/javascript.svg" alt="JavaScript" width="200"/></a></td> <td><a href="https://typescriptlang.org/" target="_blank"><img src="https://cdr.bootcamp-project.com/logos/programming/typescript.svg" alt="TypeScript" width="200"/></a></td> <td><a href="https://bootcamp-project.com/" target="_blank"><img src="https://bootcamp-project.com/tbcp.svg" alt="tbcp" width="200"/></a></td> </tr> </table> ### 🏆 Acknowledgements 🏆 Thanks for these awesome resources that were used during the development of the **Bootcamp: ESLint & Prettier Configuration**: - Library: [ESLint][URL_ESlint] - Library: [Prettier][URL_Prettier] - How-to: [RTFM.page: ESLint & Prettier][RTFM_ESLintPrettier] - How-to: [RTFM.page: Mocha + Chai][RTFM_MochaChai] - How-to: [RTFM.page: TypeScript][RTFM_TypeScript] - How-to: [TBCP-Framework: Modern Web Application][TBCP_FW_WebApp] ## 📑 Changelog 📑 See [CHANGELOG][Repo_Changelog] for more information. ## 📋 Roadmap 📋 See the [open issues][Repo_Issues] for a list of proposed features (and known issues). ## 🤝 Contribute 🤝 Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are **greatly appreciated**. Please read the [contribution guidelines][TBCP_Contribution] first. 0. [Give us a star][Repo_Stars], it's really important! 😅 1. Fork the Project: (`git clone https://gitlab.com/the-bootcamp-project/configurations/eslinttier.git`) 2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`) 3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`) 4. Push to the Branch (`git push origin feature/AmazingFeature`) 5. Open a Pull Request ## 📜 License 📜 See [LICENSE][Repo_License] for more information. ## 💌 Contact 💌 [Bootcamp contributors][TBCP_Homepage] - `contributors` @ `bootcamp-project` .com <!-- ---------------------------------------------------------------------------------------------------------------------------------- --> <!-- ---------------------------------------------------------------------------------------------------------------------------------- --> <!-- ---------------------------------------------------------------------------------------------------------------------------------- --> [Project_Homepage]: https://configurations.bootcamp-project.com/#/code_quality/eslinttier [Project_Docs]: https://configurations.bootcamp-project.com/#/code_quality/eslinttier [Project_Config]: https://configurations.bootcamp-project.com/#/code_quality/eslinttier_config <!-- ---------------------------------------------------------------------------------------------------------------------------------- --> [Repo_URL]: https://gitlab.com/the-bootcamp-project/configurations/eslinttier [Repo_Issues]: https://gitlab.com/the-bootcamp-project/configurations/eslinttier/-/issues [Repo_Forks]: https://gitlab.com/the-bootcamp-project/configurations/eslinttier/-/forks [Repo_Stars]: https://gitlab.com/the-bootcamp-project/configurations/eslinttier/-/starrers [Repo_Tests]: https://gitlab.com/the-bootcamp-project/configurations/eslinttier/-/tree/main/tests [Repo_License]: https://gitlab.com/the-bootcamp-project/configurations/eslinttier/-/blob/main/LICENSE [Repo_Changelog]: https://gitlab.com/the-bootcamp-project/configurations/eslinttier/-/blob/main/CHANGELOG <!-- ---------------------------------------------------------------------------------------------------------------------------------- --> [TBCP_Homepage]: https://bootcamp-project.com [TBCP_Configurations]: https://configurations.bootcamp-project.com [TBCP_FW_WebApp]: https://frameworks.bootcamp-project.com/#/webapp/index [TBCP_FW_WebExt]: https://frameworks.bootcamp-project.com/#/browser_extension/index [TBCP_FW_Desktop]: https://frameworks.bootcamp-project.com/#/native_desktop/index [TBCP_FW_Mobile]: https://frameworks.bootcamp-project.com/#/native_mobile/index [TBCP_Contribution]: https://bootcamp-project.com/#code_of_conduct <!-- ---------------------------------------------------------------------------------------------------------------------------------- --> [RTFM_Webpack]: https://dev.rtfm.page/#/working_with/javascript/webpack [RTFM_MochaChai]: https://dev.rtfm.page/#/working_with/javascript/mocha_chai_sinon_karma [RTFM_TypeScript]: https://dev.rtfm.page/#/working_with/javascript/typescript [RTFM_Tailwind]: https://dev.rtfm.page/#/working_with/javascript/tailwindcss [RTFM_Svelte]: https://dev.rtfm.page/#/working_with/javascript/svelte [RTFM_Rollup]: https://dev.rtfm.page/#/working_with/javascript/rollup [RTFM_Postcss]: https://dev.rtfm.page/#/working_with/javascript/postcss [RTFM_Jest]: https://dev.rtfm.page/#/working_with/javascript/jest [RTFM_ESLintPrettier]: https://dev.rtfm.page/#/working_with/javascript/eslint_prettier <!-- ---------------------------------------------------------------------------------------------------------------------------------- --> [URL_Webpack]: https://webpack.js.org/ [URL_TypeScript]: https://www.typescriptlang.org/ [URL_PostCSS]: https://postcss.org/ [URL_Autoprefixer]: https://autoprefixer.github.io/ [URL_Svelte]: https://svelte.dev/ [URL_WebExt]: https://extensionworkshop.com/ [URL_Tailwind]: https://tailwindcss.com/ [URL_Rollup]: https://rollupjs.org [URL_Jest]: https://jestjs.io/ [URL_ESlint]: https://eslint.org/ [URL_Prettier]: https://prettier.io/ [URL_Electron]: https://www.electronjs.org/ [URL_Capacitor]: https://capacitorjs.com/ <!-- ---------------------------------------------------------------------------------------------------------------------------------- --> <!-- ---------------------------------------------------------------------------------------------------------------------------------- --> <!-- ---------------------------------------------------------------------------------------------------------------------------------- -->