diff --git a/.vscode/settings.json b/.vscode/settings.json index 1d5189b..73670b1 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -91,15 +91,21 @@ // Code Spell Checker "cSpell.words": [ - "techmmunity", - "nextjs", - "sonarjs", + "backreference", + "camelcase", "dbaeumer", + "eqeqeq", "eslintconfig", - "styleguide", + "Guilded", + "iife", + "mischeck", + "nextjs", + "nonoctal", "passhref", "polyfillio", "rushstack", - "Guilded" + "sonarjs", + "styleguide", + "techmmunity" ] } diff --git a/CHANGELOG.md b/CHANGELOG.md index 73215af..d9d1430 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed +### Dependencies + +## [5.2.0] - 2022-01-03 + +### Added + +- `@typescript-eslint/consistent-type-imports` rule + +### Changed + +- Improve `import-helpers/order-imports` config +- Improve `jest/require-top-level-describe` config + +### Fixed + +### Removed + +### Dependencies + ## [5.1.3] - 2021-11-16 ### Added diff --git a/README.md b/README.md index 1d88913..1736910 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,11 @@ In this package, you can find the **Techmmunity Style Guide**. We try to keep a clean and consistent code style, with modern features and using best practices. -[![Discord Community](https://img.shields.io/badge/discord%20community-5865F2?style=for-the-badge&labelColor=5865F2&logo=discord&logoColor=ffffff)](https://discord.gg/TakYksUzzZ) +[![Discord Community](https://img.shields.io/badge/discord%20community-5865F2?style=for-the-badge&labelColor=5865F2&logo=discord&logoColor=ffffff)](https://discord.gg/NMtAJ6whG7) + +## :warning: WARNING :warning: + +This package may not be updated so often, but it not means that it has been abandoned. We do the config in a way to (almost) never have to touch it again, and we only update the package to add new features, what may don't need to happen so often. ## Badges @@ -46,7 +50,7 @@ In this package, you can find the **Techmmunity Style Guide**. We try to keep a - Constant maintenance - Ready-to-go: You don't need any extra config - Bye bye prettier: You don't need to be using the prettier extension for VSCode if you have this baby on your project -- Direct support: Join our guilded community and get your questions answered +- Direct support: Join our discord community and get your questions answered ## Install @@ -54,6 +58,27 @@ In this package, you can find the **Techmmunity Style Guide**. We try to keep a yarn add -D @techmmunity/eslint-config eslint prettier ``` +**Obs:** If you are using **VSCode**, you may need/want to do some [extra steps](#extra---vscode-tips--tricks). + +## Basic Usage + +1 - Create a `.eslintrc.json` file in the root of your project + +2 - Put the following content inside the file: + +```json +{ + "root": true, + "extends": "@techmmunity/eslint-config" +} +``` + +3 - Restart the VSCode, and it's done! + +## Need more examples? + +We provide an [example repository](https://github.com/techmmunity/eslint-config/tree/master/docs/examples/common), you can give a look at it, or [join our discord community](https://discord.gg/NMtAJ6whG7) and make some questions! + ## Modules **Alert:** After any change at `eslintrc.json` file, you must restart VSCode. @@ -297,10 +322,6 @@ To disable Prettier, you just need to add this to your vscode configs: You can access this configs by pressing `Ctrl + Shift + P` and tipping `Preferences: Open Settings (JSON)`. -## Need more examples? - -We provide an [example repository](https://github.com/techmmunity/eslint-config/tree/master/docs/examples/common), you can give a look at it, or [join our guilded community](https://guilded.gg/techmmunity) and make some questions! - ## Extra - VSCode Tips & Tricks ### See the errors and warnings diff --git a/package.json b/package.json index f2b602d..a7d92f8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@techmmunity/eslint-config", - "version": "5.1.3", + "version": "5.2.0", "license": "Apache-2.0", "author": "Techmmunity", "description": "Techmmunity Style Guide", diff --git a/src/configs/common.js b/src/configs/common.js index ca290d0..505e8d4 100644 --- a/src/configs/common.js +++ b/src/configs/common.js @@ -1,3 +1,4 @@ +/* eslint-disable no-useless-escape */ /* eslint-disable no-magic-numbers */ /* @@ -45,9 +46,10 @@ module.exports = { }, }, { - files: ["**/*.spec.js", "**/*.test.js"], + files: ["**/*.spec.{js,ts}", "**/*.test.{js,ts}"], rules: { "no-magic-numbers": "off", + "sonarjs/no-duplicate-string": "off", }, }, ], @@ -337,7 +339,18 @@ module.exports = { "import-helpers/order-imports": [ "warn", { - groups: ["module", ["parent", "sibling", "index"]], + newlinesBetween: "always", + groups: [ + "module", + "parent", + ["sibling", "index"], + // eslint-disable-next-line prettier/prettier + ["/\/enums?\//", "/\/types?\//", "/\/types?.(ts|js)$/"], + ], + alphabetize: { + order: "asc", + ignoreCase: true, + }, }, ], }, diff --git a/src/configs/jest.js b/src/configs/jest.js index 50a9f8e..568e909 100644 --- a/src/configs/jest.js +++ b/src/configs/jest.js @@ -8,7 +8,7 @@ module.exports = { /** * Plugin - Jest Formatting * - * https://github.com/jest-community/eslint-plugin-jest/tree/main/docs/rules + * https://github.com/dangreenisrael/eslint-plugin-jest-formatting/tree/master/docs/rules */ "jest-formatting/padding-around-all": "error", /** @@ -32,6 +32,11 @@ module.exports = { "jest/prefer-to-contain": "error", "jest/prefer-to-have-length": "error", "jest/prefer-todo": "error", - "jest/require-top-level-describe": "error", + "jest/require-top-level-describe": [ + "error", + { + maxNumberOfTopLevelDescribes: 2, + }, + ], }, }; diff --git a/src/configs/typescript.js b/src/configs/typescript.js index 51f7668..1351fe5 100644 --- a/src/configs/typescript.js +++ b/src/configs/typescript.js @@ -65,6 +65,7 @@ module.exports = { "@typescript-eslint/consistent-indexed-object-style": "error", "@typescript-eslint/consistent-type-assertions": "error", "@typescript-eslint/consistent-type-definitions": ["error", "interface"], + "@typescript-eslint/consistent-type-imports": "error", "@typescript-eslint/explicit-member-accessibility": "error", "@typescript-eslint/explicit-module-boundary-types": "off", "@typescript-eslint/member-delimiter-style": "error",