From adc20fcc323e46554f24b4872213f9233eb9d6fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=20G=C3=B3mez?= Date: Mon, 2 Sep 2024 16:17:41 +0200 Subject: [PATCH] feat: add course codely config (#11) --- README.md | 56 +++++++++++++++++++++++++++++++++------- configs/codely-course.js | 10 +++++++ index.js | 4 ++- package.json | 2 +- 4 files changed, 60 insertions(+), 12 deletions(-) create mode 100644 configs/codely-course.js diff --git a/README.md b/README.md index 47fe28c..af45dfb 100644 --- a/README.md +++ b/README.md @@ -28,9 +28,11 @@ ## πŸ‘€ How to use 1. Install the dependency. + ```bash npm install --save-dev eslint-config-codely ``` + 2. Add it to your `eslint.config.js`: ```js @@ -47,16 +49,47 @@ export default [ ] ``` +Also, you can use the `full` config, which includes the `js`, `ts` and very opinionated Codely configs. + +```js +import eslintConfigCodely from "eslint-config-codely"; + +export default [ + ...eslintConfigCodely.full, + { + // Your config here + } +] +``` + +We have a `course` setting. This is the same as the `full` config, but with a narrower width due to the zoom used in +videos: + +```js +import eslintConfigCodely from "eslint-config-codely"; + +export default [ + ...eslintConfigCodely.course, + { + // Your config here + } +] +``` + ℹ️ Please note that some of the rules enabled by default require that you have `strict: true` in your `tsconfig.json`. ## πŸ€” What it does -- Lints JavaScript using [`eslint:recommended`](https://eslint.org/docs/latest/user-guide/configuring/configuration-files#using-eslintrecommended) and [Prettier](https://prettier.io/). -- Additionally, lints TypeScript using [`@typescript-eslint/recommended` and `@typescript-eslint/recommended-requiring-type-checking`](https://typescript-eslint.io/docs/linting/configs). +- Lints JavaScript using [ + `eslint:recommended`](https://eslint.org/docs/latest/user-guide/configuring/configuration-files#using-eslintrecommended) + and [Prettier](https://prettier.io/). +- Additionally, lints TypeScript using [`@typescript-eslint/recommended` and + `@typescript-eslint/recommended-requiring-type-checking`](https://typescript-eslint.io/docs/linting/configs). - Uses the following plugins: - - [`import`](https://github.com/import-js/eslint-plugin-import/): helps validate proper imports. - - [`simple-import-sort`](https://github.com/lydell/eslint-plugin-simple-import-sort/): sorts imports. - - [`unused-imports`](https://github.com/sweepline/eslint-plugin-unused-imports): finds and removes unused ES6 module imports. + - [`import`](https://github.com/import-js/eslint-plugin-import/): helps validate proper imports. + - [`simple-import-sort`](https://github.com/lydell/eslint-plugin-simple-import-sort/): sorts imports. + - [`unused-imports`](https://github.com/sweepline/eslint-plugin-unused-imports): finds and removes unused ES6 module + imports. - Uses rules inside the [configs](configs) folder. ## πŸ‘ŒΒ Codely Code Quality Standards @@ -64,16 +97,19 @@ export default [ Publishing this package we are committing ourselves to the following code quality standards: - 🀝 Respect **Semantic Versioning**: No breaking changes in patch or minor versions. -- 🀏 No surprises in transitive dependencies: Use the **bare minimum dependencies** needed to meet the purpose. -- 🎯 **One specific purpose** to meet without having to carry a bunch of unnecessary other utilities. -- βœ…Β **Tests** as documentation and usage examples. +- 🀏 No surprises in transitive dependencies: Use the **bare minimum dependencies** needed to meet the purpose. +- 🎯 **One specific purpose** to meet without having to carry a bunch of unnecessary other utilities. +- βœ… **Tests** as documentation and usage examples. - πŸ“– **Well documented ReadMe** showing how to install and use. - βš–οΈ **License favoring Open Source** and collaboration. ## πŸ”€ Related resources -- [πŸ”¦ Linting en JavaScript y TypeScript](https://pro.codely.com/library/linting-en-javascript-y-typescript-188432/446893/about/): Used as a template to bootstrap this plugin. -- [🎯 Codely's ESLint Hexagonal Architecture plugin](https://github.com/CodelyTV/eslint-plugin-hexagonal-architecture): A plugin that helps you to enforce hexagonal architecture best practises. Valid for your JavaScript or TypeScript projects. +- [πŸ”¦ Linting en JavaScript y TypeScript](https://pro.codely.com/library/linting-en-javascript-y-typescript-188432/446893/about/): + Used as a template to bootstrap this plugin. +- [🎯 Codely's ESLint Hexagonal Architecture plugin](https://github.com/CodelyTV/eslint-plugin-hexagonal-architecture): A + plugin that helps you to enforce hexagonal architecture best practises. Valid for your JavaScript or TypeScript + projects. Opinionated skeletons ready for different purposes: diff --git a/configs/codely-course.js b/configs/codely-course.js new file mode 100644 index 0000000..d685cb2 --- /dev/null +++ b/configs/codely-course.js @@ -0,0 +1,10 @@ +import eslintPluginCodely from "./codely-full.js"; + +export default [ + ...eslintPluginCodely, + { + rules: { + "prettier/prettier": ["error", { printWidth: 80, useTabs: true, tabWidth: 4 }], + }, + }, +]; diff --git a/index.js b/index.js index 5d2e32d..ed82ef6 100644 --- a/index.js +++ b/index.js @@ -1,11 +1,13 @@ +import courseConfig from "./configs/codely-course.js"; import fullConfig from "./configs/codely-full.js"; import jsConfig from "./configs/codely-js.js"; import tsConfig from "./configs/codely-ts.js"; const eslintConfigCodely = { + course: courseConfig, + full: fullConfig, js: jsConfig, ts: tsConfig, - full: fullConfig, }; export default eslintConfigCodely; diff --git a/package.json b/package.json index 17b1769..5b196ab 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "eslint-config-codely", - "version": "4.1.0", + "version": "4.2.0", "description": "Codely's ESLint and Prettier Config", "main": "index.js", "scripts": {