Skip to content

Commit

Permalink
Merge pull request #51 from Boehringer-Ingelheim/feature/dependency-e…
Browse files Browse the repository at this point in the history
…slint-plugin-perfectionist-3

feat(deps): update eslint-plugin-perfectionist@3
  • Loading branch information
SimonGolms authored Aug 7, 2024
2 parents dd5df78 + aca27e6 commit 0d6f7c2
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 29 deletions.
60 changes: 39 additions & 21 deletions base/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
const { SORT_CLASSES_GROUPS, SORT_IMPORTS_GROUPS } = require('../lib/eslint-plugin-perfectionist');
const {
SORT_CLASSES_GROUPS,
SORT_IMPORTS_GROUPS,
SORT_INTERSECTION_TYPES_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');
const eslintPluginPerfectionist = require('eslint-plugin-perfectionist');

/** @type {import('eslint').ESLint.ConfigData & { parserOptions: import('eslint').ESLint.ConfigData['parserOptions'] & import('@typescript-eslint/parser').ParserOptions } } */
module.exports = {
Expand All @@ -18,7 +23,7 @@ module.exports = {
'plugin:deprecation/recommended',
'plugin:import/recommended',
'plugin:import/typescript',
'plugin:perfectionist/recommended-natural',
'plugin:perfectionist/recommended-natural-legacy',
'plugin:sonarjs/recommended-legacy',
],
overrides: [
Expand Down Expand Up @@ -105,31 +110,44 @@ module.exports = {
'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', { groups: SORT_CLASSES_GROUPS, '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-classes': [
'error',
{
...eslintPluginPerfectionist.configs['recommended-natural-legacy'].rules['perfectionist/sort-classes'][1],
groups: SORT_CLASSES_GROUPS,
},
],
'perfectionist/sort-imports': [
'error',
{
...eslintPluginPerfectionist.configs['recommended-natural-legacy'].rules['perfectionist/sort-imports'][1],
groups: SORT_IMPORTS_GROUPS,
'ignore-case': true,
'newlines-between': 'ignore',
type: 'natural',
newlinesBetween: 'ignore',
},
],
'perfectionist/sort-intersection-types': [
'error',
{
...eslintPluginPerfectionist.configs['recommended-natural-legacy'].rules[
'perfectionist/sort-intersection-types'
][1],
groups: SORT_INTERSECTION_TYPES_GROUPS,
},
],
'perfectionist/sort-named-imports': [
'error',
{
...eslintPluginPerfectionist.configs['recommended-natural-legacy'].rules['perfectionist/sort-named-imports'][1],
ignoreAlias: true,
},
],
'perfectionist/sort-objects': [
'error',
{
...eslintPluginPerfectionist.configs['recommended-natural-legacy'].rules['perfectionist/sort-objects'][1],
partitionByComment: true,
},
],
'perfectionist/sort-interfaces': ['error', { 'ignore-case': true, type: 'natural' }],
'perfectionist/sort-intersection-types': ['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
21 changes: 21 additions & 0 deletions lib/eslint-plugin-perfectionist.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,28 @@ const SORT_CLASSES_GROUPS = [
'unknown',
];

/**
* This array can be used to configure the perfectionist/sort-intersection-types rule.
* The following group names are available for configuration: https://perfectionist.dev/rules/sort-intersection-types#groups
*/
const SORT_INTERSECTION_TYPES_GROUPS = [
'conditional',
'function',
'import',
'interseciont',
'union',
'named',
'keyword',
'literal',
'operator',
'tuple',
'object',
'nullish',
'unknown',
];

module.exports = {
SORT_CLASSES_GROUPS,
SORT_IMPORTS_GROUPS,
SORT_INTERSECTION_TYPES_GROUPS,
};
33 changes: 26 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"eslint-plugin-deprecation": "^3.0.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsx-a11y": "^6.9.0",
"eslint-plugin-perfectionist": "^2.11.0",
"eslint-plugin-perfectionist": "^3.0.0",
"eslint-plugin-playwright": "^1.6.2",
"eslint-plugin-react": "^7.35.0",
"eslint-plugin-react-hooks": "^4.6.2",
Expand Down

0 comments on commit 0d6f7c2

Please sign in to comment.