@itcase/lint 1.1.71 → 1.1.73

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,7 +9,6 @@ const sortExports = [
9
9
  partitionByComment: false,
10
10
  partitionByNewLine: false,
11
11
  newlinesBetween: 'ignore',
12
- groupKind: 'mixed',
13
12
  groups: [],
14
13
  customGroups: [],
15
14
  },
@@ -4,16 +4,26 @@ import { props } from './sort/props.js'
4
4
 
5
5
  const groups = [...props]
6
6
 
7
+ // Convert object to array of objects format
8
+ const convertCustomGroupsToArray = (groupsObj) => {
9
+ return Object.entries(groupsObj).map(([groupName, elementNamePattern]) => ({
10
+ groupName,
11
+ elementNamePattern,
12
+ }))
13
+ }
14
+
15
+ const allCustomGroups = {
16
+ ...wrapArrayWithCaretAndDollarAnchors(groups),
17
+ ...customGroups,
18
+ }
19
+
7
20
  const sortJSXProps = [
8
21
  'error',
9
22
  {
10
23
  type: 'natural',
11
24
  order: 'asc',
12
25
  groups: groups,
13
- customGroups: {
14
- ...wrapArrayWithCaretAndDollarAnchors(groups),
15
- ...customGroups,
16
- },
26
+ customGroups: convertCustomGroupsToArray(allCustomGroups),
17
27
  },
18
28
  ]
19
29
 
@@ -7,7 +7,6 @@ const sortNamedExports = [
7
7
  ignoreAlias: false,
8
8
  ignoreCase: true,
9
9
  specialCharacters: 'keep',
10
- groupKind: 'mixed',
11
10
  partitionByNewLine: false,
12
11
  partitionByComment: false,
13
12
  newlinesBetween: 'ignore',
@@ -1,21 +1,31 @@
1
1
  import { wrapArrayWithCaretAndDollarAnchors } from '../utils.js'
2
2
 
3
- // In what order they are written, thats how they will be sorted
3
+ // In what order they are written, that's how they will be sorted
4
4
  // В каком порядке они записаны, так они и будут отсортированы
5
5
  const groups = ['id']
6
6
 
7
7
  const customRulesForGroups = {}
8
8
 
9
+ // Convert object to array of objects format
10
+ const convertCustomGroupsToArray = (groupsObj) => {
11
+ return Object.entries(groupsObj).map(([groupName, elementNamePattern]) => ({
12
+ groupName,
13
+ elementNamePattern,
14
+ }))
15
+ }
16
+
17
+ const allCustomGroups = {
18
+ ...wrapArrayWithCaretAndDollarAnchors(groups),
19
+ ...customRulesForGroups,
20
+ }
21
+
9
22
  const sortObjectTypes = [
10
23
  'error',
11
24
  {
12
25
  type: 'natural',
13
26
  order: 'asc',
14
27
  groups: groups,
15
- customGroups: {
16
- ...wrapArrayWithCaretAndDollarAnchors(groups),
17
- ...customRulesForGroups,
18
- },
28
+ customGroups: convertCustomGroupsToArray(allCustomGroups),
19
29
  },
20
30
  ]
21
31
 
@@ -4,14 +4,30 @@ import { props } from './sort/props.js'
4
4
 
5
5
  const groups = [...props]
6
6
 
7
+ // Convert object to array of objects format
8
+ const convertCustomGroupsToArray = (groupsObj) => {
9
+ return Object.entries(groupsObj).map(([groupName, elementNamePattern]) => ({
10
+ groupName,
11
+ elementNamePattern,
12
+ }))
13
+ }
14
+
15
+ const allCustomGroups = {
16
+ ...wrapArrayWithCaretAndDollarAnchors(groups),
17
+ ...customGroups,
18
+ }
19
+
7
20
  const sortObjects = [
8
21
  'error',
9
22
  {
10
23
  type: 'unsorted', // Don't sort objects passed to constructor
11
24
  groups: ['MESSAGES_FIELDS'],
12
- customGroups: {
13
- formConfig: '.*(?<!FormConfig)$',
14
- },
25
+ customGroups: [
26
+ {
27
+ groupName: 'formConfig',
28
+ elementNamePattern: '.*(?<!FormConfig)$',
29
+ },
30
+ ],
15
31
  useConfigurationIf: {
16
32
  allNamesMatchPattern: 'MESSAGES_FIELDS',
17
33
  callingFunctionNamePattern: '^.*',
@@ -21,10 +37,7 @@ const sortObjects = [
21
37
  type: 'natural',
22
38
  order: 'asc',
23
39
  groups: groups,
24
- customGroups: {
25
- ...wrapArrayWithCaretAndDollarAnchors(groups),
26
- ...customGroups,
27
- },
40
+ customGroups: convertCustomGroupsToArray(allCustomGroups),
28
41
  },
29
42
  ]
30
43
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itcase/lint",
3
- "version": "1.1.71",
3
+ "version": "1.1.73",
4
4
  "author": "ITCase",
5
5
  "description": "Code style linter configuration presets",
6
6
  "engines": {