@borela-tech/eslint-config 2.1.2 → 2.2.0
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.
- package/dist/index.d.ts +2 -2
- package/dist/index.js +273 -34
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
- package/src/index.ts +18 -5
- package/src/rules/__tests__/importsAndReExportsAtTop.test.ts +3 -1
- package/src/rules/__tests__/individualImports.test.ts +3 -1
- package/src/rules/__tests__/individualReExports.test.ts +3 -1
- package/src/rules/__tests__/multilineUnionTypes.test.ts +75 -0
- package/src/rules/__tests__/singleLineImports.test.ts +129 -0
- package/src/rules/__tests__/singleLineReExports.test.ts +100 -0
- package/src/rules/__tests__/sortedImports.test.ts +37 -1
- package/src/rules/__tests__/sortedReExports.test.ts +27 -1
- package/src/rules/importsAndReExportsAtTop/CategorizedStatements.ts +2 -2
- package/src/rules/importsAndReExportsAtTop/categorizeStatements.ts +7 -6
- package/src/rules/importsAndReExportsAtTop/generateSortedText.ts +4 -6
- package/src/rules/importsAndReExportsAtTop/getStatementType.ts +1 -1
- package/src/rules/importsAndReExportsAtTop/index.ts +5 -5
- package/src/rules/importsAndReExportsAtTop/isImportDeclaration.ts +7 -0
- package/src/rules/importsAndReExportsAtTop/isReExport.ts +12 -0
- package/src/rules/individualImports.ts +4 -3
- package/src/rules/individualReExports.ts +8 -9
- package/src/rules/multilineUnionTypes/createFix.ts +13 -0
- package/src/rules/multilineUnionTypes/index.ts +52 -0
- package/src/rules/multilineUnionTypes/isMultiline.ts +6 -0
- package/src/rules/singleLineImports/createFix.ts +23 -0
- package/src/rules/singleLineImports/formatAttributes.ts +20 -0
- package/src/rules/singleLineImports/formatNamed.ts +9 -0
- package/src/rules/singleLineImports/formatSpecifiers.ts +32 -0
- package/src/rules/singleLineImports/index.ts +34 -0
- package/src/rules/singleLineImports/isMultiline.ts +6 -0
- package/src/rules/singleLineReExports/createFix.ts +29 -0
- package/src/rules/singleLineReExports/index.ts +48 -0
- package/src/rules/singleLineReExports/isMultiline.ts +6 -0
- package/src/rules/sortedImports/ImportError.ts +4 -1
- package/src/rules/sortedImports/ImportGroup.ts +2 -1
- package/src/rules/sortedImports/ImportGroupOrder.ts +2 -1
- package/src/rules/sortedImports/areSpecifiersSorted.ts +1 -1
- package/src/rules/sortedImports/categorizeImport.ts +4 -0
- package/src/rules/sortedImports/checkAlphabeticalSorting.ts +1 -1
- package/src/rules/sortedImports/createFix/buildSortedCode.ts +2 -1
- package/src/rules/sortedImports/createFix/formatNamedImport.ts +3 -2
- package/src/rules/sortedImports/createFix/getReplacementRange.ts +3 -3
- package/src/rules/sortedImports/createFix/groupImportsByType.ts +1 -0
- package/src/rules/sortedImports/createFix/index.ts +10 -11
- package/src/rules/sortedImports/createFix/sortImportGroups.ts +2 -1
- package/src/rules/sortedImports/getSortKey.ts +8 -2
- package/src/rules/sortedImports/index.ts +8 -5
- package/src/rules/sortedImports/sortSpecifiersText.ts +4 -3
- package/src/rules/sortedReExports/CategorizedReExport.ts +14 -3
- package/src/rules/sortedReExports/ReExportError.ts +5 -2
- package/src/rules/sortedReExports/ReExportGroup.ts +1 -0
- package/src/rules/sortedReExports/ReExportGroupOrder.ts +2 -1
- package/src/rules/sortedReExports/areSpecifiersSorted.ts +1 -1
- package/src/rules/sortedReExports/categorizeReExport.ts +8 -4
- package/src/rules/sortedReExports/categorizeReExports.ts +1 -1
- package/src/rules/sortedReExports/checkAlphabeticalSorting.ts +1 -1
- package/src/rules/sortedReExports/createFix/buildSortedCode.ts +2 -1
- package/src/rules/sortedReExports/createFix/formatNamedReExport.ts +3 -2
- package/src/rules/sortedReExports/createFix/getReplacementRange.ts +1 -1
- package/src/rules/sortedReExports/createFix/groupReExportsByType.ts +1 -0
- package/src/rules/sortedReExports/createFix/index.ts +10 -11
- package/src/rules/sortedReExports/createFix/sortExportGroups.ts +2 -1
- package/src/rules/sortedReExports/getNamedSpecifiers.ts +1 -1
- package/src/rules/sortedReExports/getReExportGroups.ts +1 -1
- package/src/rules/sortedReExports/getSortKey.ts +11 -5
- package/src/rules/sortedReExports/index.ts +8 -5
- package/src/rules/sortedReExports/isNamedReExport.ts +2 -2
- package/src/rules/sortedReExports/sortSpecifiersText.ts +4 -3
- package/src/rules/importsAndReExportsAtTop/ReExport.ts +0 -5
- /package/src/{rules/sortedReExports → lib}/ReExportDeclaration.ts +0 -0
|
@@ -5,14 +5,17 @@ import {checkSpecifiersSorting} from './checkSpecifiersSorting'
|
|
|
5
5
|
import {createFix} from './createFix'
|
|
6
6
|
import {getReExportGroups} from './getReExportGroups'
|
|
7
7
|
import type {ReExportError} from './ReExportError'
|
|
8
|
-
import type {
|
|
9
|
-
import type {TSESTree} from '@typescript-eslint/types'
|
|
8
|
+
import type {TSESLint} from '@typescript-eslint/utils'
|
|
10
9
|
|
|
11
|
-
|
|
10
|
+
type MessageIds =
|
|
11
|
+
| 'sortedReExports'
|
|
12
|
+
| 'sortedNames'
|
|
13
|
+
| 'wrongGroup'
|
|
14
|
+
|
|
15
|
+
export const sortedReExports: TSESLint.RuleModule<MessageIds, []> = {
|
|
12
16
|
meta: {
|
|
13
17
|
docs: {
|
|
14
18
|
description: 'Enforce sorted exports alphabetically',
|
|
15
|
-
recommended: true,
|
|
16
19
|
},
|
|
17
20
|
fixable: 'code',
|
|
18
21
|
messages: {
|
|
@@ -26,7 +29,7 @@ export const sortedReExports: Rule.RuleModule = {
|
|
|
26
29
|
create(context) {
|
|
27
30
|
return {
|
|
28
31
|
Program(node) {
|
|
29
|
-
const body = node.body
|
|
32
|
+
const body = node.body
|
|
30
33
|
const reExportGroups = getReExportGroups(body)
|
|
31
34
|
if (reExportGroups.length === 0)
|
|
32
35
|
return
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {CategorizedNamedReExport} from './CategorizedNamedReExport'
|
|
1
|
+
import type {CategorizedNamedReExport} from './CategorizedNamedReExport'
|
|
2
2
|
import type {CategorizedReExport} from './CategorizedReExport'
|
|
3
3
|
|
|
4
4
|
export function isNamedReExport(x: CategorizedReExport): x is CategorizedNamedReExport {
|
|
5
|
-
return x.group !== 're-export-all'
|
|
5
|
+
return x.group !== 're-export-all' && x.group !== 're-export-namespace'
|
|
6
6
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {compare} from '
|
|
1
|
+
import {compare} from '@lib/compare'
|
|
2
2
|
import {getSpecifierName} from './getSpecifierName'
|
|
3
|
-
import type {
|
|
3
|
+
import type {TSESLint} from '@typescript-eslint/utils'
|
|
4
|
+
import type {TSESTree} from '@typescript-eslint/utils'
|
|
4
5
|
|
|
5
6
|
export function sortSpecifiersText(
|
|
6
7
|
specifiers: TSESTree.ExportSpecifier[],
|
|
7
|
-
sourceCode:
|
|
8
|
+
sourceCode: TSESLint.SourceCode,
|
|
8
9
|
): string {
|
|
9
10
|
const sorted = [...specifiers].sort((a, b) => {
|
|
10
11
|
const nameA = getSpecifierName(a)
|
|
File without changes
|