Skip to content

Commit

Permalink
Merge pull request #25 from Boehringer-Ingelheim/next
Browse files Browse the repository at this point in the history
release
  • Loading branch information
SimonGolms authored Nov 10, 2023
2 parents ace53ed + 85c76e1 commit d3a26bb
Show file tree
Hide file tree
Showing 12 changed files with 3,086 additions and 3,357 deletions.
15 changes: 4 additions & 11 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,14 @@ module.exports = {
es2022: true,
node: true,
},
extends: ["eslint:recommended"],
plugins: ["sort-keys-plus"],
extends: ["eslint:recommended", "plugin:perfectionist/recommended-natural"],
rules: {
/**
* Required to fix sort-keys automatically, since this is not done by default.
* See: https://github.com/forivall/eslint-plugin-sort-keys-plus
*/
"sort-keys-plus/sort-keys": [
"perfectionist/sort-objects": [
"error",
"asc",
{
allowLineSeparatedGroups: true,
caseSensitive: false,
natural: true,
"partition-by-comment": true,
},
],
"sort-keys": "off", // disabled due to conflict with eslint-plugin-perfectionist
},
};
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v18
v20
10 changes: 9 additions & 1 deletion .releaserc.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
/** @type {import('semantic-release').Options} */
module.exports = {
branches: [
"master",
{
name: "next",
prerelease: true,
},
],
plugins: [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/changelog",
"@semantic-release/npm",
[
"@semantic-release/git",
{
assets: ["CHANGELOG.md", "README.md", "package.json", "package-lock.json"],
message: "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}",
},
],
"@semantic-release/github",
"@semantic-release/npm",
],
};
85 changes: 85 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,88 @@
# [4.0.0-next.4](https://github.com/Boehringer-Ingelheim/eslint-config/compare/v4.0.0-next.3...v4.0.0-next.4) (2023-11-09)


### Bug Fixes

* fixes wrong type hints in base config and react config ([ef60c9f](https://github.com/Boehringer-Ingelheim/eslint-config/commit/ef60c9f8c39eee91087b4e8a4bb0e7140d55e939))

# [4.0.0-next.3](https://github.com/Boehringer-Ingelheim/eslint-config/compare/v4.0.0-next.2...v4.0.0-next.3) (2023-11-09)


### Features

* **local:** add shared-config for performance improvements for local development ([07dd315](https://github.com/Boehringer-Ingelheim/eslint-config/commit/07dd3158bbf02245f8d90b7e7f484be8e727fac3))


### Performance Improvements

* **base:** disable import rules recommended by typescript-eslint ([f35b2a8](https://github.com/Boehringer-Ingelheim/eslint-config/commit/f35b2a88ea619d00088574e7e3aa87f852980e31))

# [4.0.0-next.2](https://github.com/Boehringer-Ingelheim/eslint-config/compare/v4.0.0-next.1...v4.0.0-next.2) (2023-10-26)


### Features

* **base:** move consistent type imports rules into strict configuration ([1c55d79](https://github.com/Boehringer-Ingelheim/eslint-config/commit/1c55d7939e6a74d4bb920edc9da780e87ee8e581))

# [4.0.0-next.1](https://github.com/Boehringer-Ingelheim/eslint-config/compare/v3.1.0-next.2...v4.0.0-next.1) (2023-10-19)


### Features

* **typescript:** enable "@typescript-eslint/consistent-type-imports" rule ([15d5447](https://github.com/Boehringer-Ingelheim/eslint-config/commit/15d5447ee5fb3e4fc4ee2263e5e8eaff0e418308))


### BREAKING CHANGES

* **typescript:** Enforces a new import style for TypeScript types

# [3.1.0-next.2](https://github.com/Boehringer-Ingelheim/eslint-config/compare/v3.1.0-next.1...v3.1.0-next.2) (2023-10-16)


### Features

* **perfectionist:** extend rule `sort-named-imports` ([bb00813](https://github.com/Boehringer-Ingelheim/eslint-config/commit/bb008130ee5903bae626f1ef63f9e7e58e629d95))

# [3.1.0-next.1](https://github.com/Boehringer-Ingelheim/eslint-config/compare/v3.0.0...v3.1.0-next.1) (2023-09-26)


### Bug Fixes

* **perfectionist:** update import groups configuration ([2513e42](https://github.com/Boehringer-Ingelheim/eslint-config/commit/2513e428957d7d97c20b08e26ba40af140f0c88a))
* **perfectionist:** natural sorting for imports and objects ([2dcb782](https://github.com/Boehringer-Ingelheim/eslint-config/commit/2dcb7821fa3d3ba0366e2938c768ee962dcd23ef))
* **perfectionist:** refine groups to sort imports ([9fd31cc](https://github.com/Boehringer-Ingelheim/eslint-config/commit/9fd31cc33fd42861e99b7f7fe979bfb37a42f87e))


### Features

* **perfectionist:** extend all the rules for natural sorting with ignoring the lower/upper case ([03d7fdc](https://github.com/Boehringer-Ingelheim/eslint-config/commit/03d7fdc346f6b5a521763ccca100612a4bf7ef06))

# [3.0.0](https://github.com/Boehringer-Ingelheim/eslint-config/compare/v2.0.0...v3.0.0) (2023-09-13)


### Features

* add eslint-plugin-perfectionist ([92c629b](https://github.com/Boehringer-Ingelheim/eslint-config/commit/92c629bf8c11205e2204b598eb3c951546edd9af))
* update to eslint-plugin-perfectionist@2 ([5da0d2d](https://github.com/Boehringer-Ingelheim/eslint-config/commit/5da0d2dc1fb1c17c0da6230582d687dab60c019b))


### BREAKING CHANGES

* update to eslint-plugin-perfectionist@2
* add eslint-plugin-perfectionist and remove eslint-plugin-sort-keys-plus

# [2.0.0](https://github.com/Boehringer-Ingelheim/eslint-config/compare/v1.1.4...v2.0.0) (2023-08-14)


### Features

* update to typescript-eslint@6 ([dc77acf](https://github.com/Boehringer-Ingelheim/eslint-config/commit/dc77acf4b8427ec36c8e42711abf86cf2ee73066))


### BREAKING CHANGES

* update to typescript-eslint@6

## [1.1.4](https://github.com/Boehringer-Ingelheim/eslint-config/compare/v1.1.3...v1.1.4) (2023-06-01)


Expand Down
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ The following plugins are used in this configuration:
- [`eslint-plugin-import`](https://github.com/import-js/eslint-plugin-import)
- [`eslint-plugin-sonarjs`](https://github.com/SonarSource/eslint-plugin-sonarjs)

Additionally, the [`eslint-plugin-sort-keys-plus`](https://github.com/forivall/eslint-plugin-sort-keys-plus) is used to automatically fix sorting issues.
Additionally, the [`eslint-plugin-perfectionist`](https://github.com/azat-io/eslint-plugin-perfectionist) is used to automatically fix sorting issues.

This configuration also sets up the TypeScript parser [`@typescript-eslint/parser`](https://typescript-eslint.io/architecture/parser) and [`eslint-import-resolver-typescript`](https://github.com/import-js/eslint-import-resolver-typescript). The TypeScript project file `./tsconfig.json` is set as default value for the project option in the parser configuration. If this is not the case, this must be changed accordingly:

Expand All @@ -84,6 +84,16 @@ module.exports = {
};
```

### `@boehringer-ingelheim/eslint-config/base/local`

```js
module.exports = {
extends: ["@boehringer-ingelheim/eslint-config/base/strict", "@boehringer-ingelheim/eslint-config/base/local"],
};
```

This shared ESLint configuration configures or disables some rules for a better performance locally. With the help of [`is-ci`](https://www.npmjs.com/package/is-ci) those configs only apply to environments outside the CI pipelines.

### `@boehringer-ingelheim/eslint-config/base/strict`

```js
Expand Down
62 changes: 39 additions & 23 deletions base/index.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
const { SORT_IMPORTS_GROUPS } = require("../lib/eslint-plugin-perfectionist");

/**
* Workaround to allow ESLint to resolve plugins that were installed
* by an external config, see https://github.com/eslint/eslint/issues/3458.
*/
require("@rushstack/eslint-patch/modern-module-resolution");

/** @type {import('eslint').ESLint.ConfigData & { parserOptions: import('eslint').ESLint.ConfigData & import('@typescript-eslint/parser').ParserOptions } } */
/** @type {import('eslint').ESLint.ConfigData & { parserOptions: import('eslint').ESLint.ConfigData['parserOptions'] & import('@typescript-eslint/parser').ParserOptions } } */
module.exports = {
env: {
es2022: true,
},
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"plugin:@typescript-eslint/recommended-type-checked",
"plugin:@typescript-eslint/stylistic-type-checked",
"plugin:import/recommended",
"plugin:import/typescript",
"plugin:perfectionist/recommended-natural",
"plugin:sonarjs/recommended",
],
overrides: [
Expand All @@ -34,9 +37,10 @@ module.exports = {
// find the tsconfig.json nearest each source file
project: true,
},
plugins: ["@typescript-eslint", "sonarjs", "sort-keys-plus"],
plugins: ["@typescript-eslint", "sonarjs"],
rules: {
// @typescript-eslint: https://github.com/typescript-eslint/typescript-eslint/tree/main/packages/eslint-plugin/docs/rules
"@typescript-eslint/adjacent-overload-signatures": "off", // disabled due to conflict with eslint-plugin-perfectionist
"@typescript-eslint/no-floating-promises": ["error", { ignoreVoid: true }],
"@typescript-eslint/no-misused-promises": [
"error",
Expand All @@ -52,7 +56,7 @@ module.exports = {
varsIgnorePattern: "^_",
},
],
"@typescript-eslint/sort-type-constituents": "error",
"@typescript-eslint/sort-type-constituents": "off", // disabled due to conflict with eslint-plugin-perfectionist

// eslint: https://github.com/eslint/eslint/tree/main/lib/rules
"arrow-body-style": ["error", "as-needed"],
Expand All @@ -75,6 +79,8 @@ module.exports = {
"prefer-const": "error",
"prefer-rest-params": "error",
"prefer-template": "error",
"sort-imports": "off", // disabled due to conflict with eslint-plugin-perfectionist
"sort-keys": "off", // disabled due to conflict with eslint-plugin-perfectionist

// eslint-plugin-import: https://github.com/import-js/eslint-plugin-import/tree/main/docs/rules
"import/no-cycle": "error",
Expand All @@ -86,30 +92,40 @@ module.exports = {
unusedExports: true,
},
],
"import/order": [
"error",
{
alphabetize: {
caseInsensitive: true,
order: "asc",
orderImportKind: "asc",
},
},
],
"import/order": "off", // disabled due to conflict with eslint-plugin-perfectionist
"import/prefer-default-export": "off",

/**
* Required to fix sort-keys automatically, since this is not done by default.
* See: https://github.com/forivall/eslint-plugin-sort-keys-plus
*/
"sort-keys-plus/sort-keys": [
// Deactivated as TypeScript provides the same checks as part of standard type checking: https://typescript-eslint.io/linting/troubleshooting/performance-troubleshooting
"import/default": "off",
"import/named": "off",
"import/namespace": "off",
"import/no-named-as-default-member": "off",

// eslint-plugin-perfectionist: https://github.com/azat-io/eslint-plugin-perfectionist
"perfectionist/sort-array-includes": ["error", { "ignore-case": true, type: "natural" }],
"perfectionist/sort-astro-attributes": ["error", { "ignore-case": true, type: "natural" }],
"perfectionist/sort-classes": ["error", { "ignore-case": true, type: "natural" }],
"perfectionist/sort-enums": ["error", { "ignore-case": true, type: "natural" }],
"perfectionist/sort-exports": ["error", { "ignore-case": true, type: "natural" }],
"perfectionist/sort-imports": [
"error",
"asc",
{
caseSensitive: false,
natural: true,
groups: SORT_IMPORTS_GROUPS,
"ignore-case": true,
"newlines-between": "ignore",
type: "natural",
},
],
"perfectionist/sort-interfaces": ["error", { "ignore-case": true, type: "natural" }],
"perfectionist/sort-jsx-props": ["error", { "ignore-case": true, type: "natural" }],
"perfectionist/sort-maps": ["error", { "ignore-case": true, type: "natural" }],
"perfectionist/sort-named-exports": ["error", { "ignore-case": true, type: "natural" }],
"perfectionist/sort-named-imports": ["error", { "ignore-alias": true, "ignore-case": true, type: "natural" }],
"perfectionist/sort-object-types": ["error", { "ignore-case": true, type: "natural" }],
"perfectionist/sort-objects": ["error", { "ignore-case": true, "partition-by-comment": true, type: "natural" }],
"perfectionist/sort-svelte-attributes": ["error", { "ignore-case": true, type: "natural" }],
"perfectionist/sort-union-types": ["error", { "ignore-case": true, type: "natural" }],
"perfectionist/sort-vue-attributes": ["error", { "ignore-case": true, type: "natural" }],
},
settings: {
"import/resolver": {
Expand Down
20 changes: 20 additions & 0 deletions base/local.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/**
* Workaround to allow ESLint to resolve plugins that were installed
* by an external config, see https://github.com/eslint/eslint/issues/3458.
*/
require("@rushstack/eslint-patch/modern-module-resolution");

const isCI = require("is-ci");

/** @type {import('eslint').ESLint.ConfigData} */
module.exports = {
rules: isCI
? {}
: {
// Only activate in CI, as suggested here: https://typescript-eslint.io/linting/troubleshooting/performance-troubleshooting#eslint-plugin-import
"import/no-cycle": "off",
"import/no-deprecated": "off",
"import/no-named-as-default": "off",
"import/no-unused-modules": "off",
},
};
10 changes: 9 additions & 1 deletion base/strict.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,13 @@ require("@rushstack/eslint-patch/modern-module-resolution");

/** @type {import('eslint').ESLint.ConfigData} */
module.exports = {
extends: ["./index.js", "plugin:@typescript-eslint/strict"],
extends: ["./index.js", "plugin:@typescript-eslint/strict-type-checked"],
rules: {
// @typescript-eslint: https://github.com/typescript-eslint/typescript-eslint/tree/main/packages/eslint-plugin/docs/rules
"@typescript-eslint/consistent-type-imports": "error",
"@typescript-eslint/no-import-type-side-effects": "error",

// eslint-plugin-import: https://github.com/import-js/eslint-plugin-import/tree/main/docs/rules
"import/consistent-type-specifier-style": ["error", "prefer-top-level"],
},
};
19 changes: 19 additions & 0 deletions lib/eslint-plugin-perfectionist.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* While the sorting of imports is done by `eslint-plugin-perfectionist/sort-imports`,
* the order and grouping of imports is still taken from the previous configuration of `eslint-plugin-import/order`,
* as it feels more natural.
* The following group names are available for configuration: https://eslint-plugin-perfectionist.azat.io/rules/sort-imports#groups
*/
const SORT_IMPORTS_GROUPS = [
["builtin", "builtin-type"],
["external", "external-type"],
["internal", "internal-type"],
["parent", "parent-type", "sibling", "sibling-type", "index", "index-type"],
["style", "side-effect"],
"object",
"unknown",
];

module.exports = {
SORT_IMPORTS_GROUPS,
};
Loading

0 comments on commit d3a26bb

Please sign in to comment.