Skip to content

Commit e7588a5

Browse files
committed
fix: improve import/export order across modules via eslint-plugin-simple-import-sort
1 parent ceac2ae commit e7588a5

File tree

419 files changed

+1610
-1193
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

419 files changed

+1610
-1193
lines changed

.eslintrc.cjs

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@
1414
* limitations under the License.
1515
*/
1616

17+
const tsconfigPath = require('./tsconfig.json')
18+
1719
module.exports = {
1820
parser: '@typescript-eslint/parser',
19-
plugins: ['@typescript-eslint', 'react', 'prettier', 'import'],
21+
plugins: ['@typescript-eslint', 'react', 'prettier', 'import', 'simple-import-sort'],
2022
env: {
2123
browser: true,
2224
es2021: true,
@@ -109,6 +111,26 @@ module.exports = {
109111
'import/prefer-default-export': 'off',
110112
'no-restricted-exports': 'off',
111113
'import/named': 'off',
114+
'simple-import-sort/imports': [
115+
'error',
116+
{
117+
groups: [
118+
// Packages `react` related packages and external packages.
119+
['^react', '^@?\\w'],
120+
// Devtron packages
121+
['^@devtron-labs'],
122+
// Internal packages.
123+
[...Object.keys(tsconfigPath.compilerOptions.paths).map((alias) => alias.replace('/*', ''))],
124+
// Side effect imports.
125+
['^\\u0000'],
126+
// Put same-folder imports, `..` and `.` last. Other relative imports.
127+
['^\\.\\.(?!/?$)', '^\\.\\./?$', '^\\./(?=.*/)(?!/?$)', '^\\.(?!/?$)', '^\\./?$',],
128+
// Style imports.
129+
[ '^.+\\.?(css|scss)$'],
130+
],
131+
},
132+
],
133+
'simple-import-sort/exports': 'error',
112134
},
113135
overrides: [
114136
{

package-lock.json

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
"eslint-plugin-prettier": "^5.1.2",
6161
"eslint-plugin-react": "^7.33.2",
6262
"eslint-plugin-react-hooks": "^4.6.0",
63+
"eslint-plugin-simple-import-sort": "^12.1.1",
6364
"glob": "^10.3.3",
6465
"husky": "^7.0.4",
6566
"json-schema": "^0.4.0",
@@ -108,10 +109,10 @@
108109
"@replit/codemirror-indentation-markers": "6.5.3",
109110
"@replit/codemirror-vscode-keymap": "6.0.2",
110111
"@types/react-dates": "^21.8.6",
111-
"@xyflow/react": "12.4.2",
112112
"@uiw/codemirror-extensions-hyper-link": "4.23.10",
113113
"@uiw/codemirror-theme-github": "4.23.7",
114114
"@uiw/react-codemirror": "4.23.7",
115+
"@xyflow/react": "12.4.2",
115116
"ansi_up": "^5.2.1",
116117
"codemirror-json-schema": "0.8.0",
117118
"dayjs": "^1.11.13",

src/Common/API/CoreAPI.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { INVALID_LICENSE_KEY, ResponseHeaders } from '@Shared/index'
2+
23
import { API_STATUS_CODES, APIOptions, FALLBACK_REQUEST_TIMEOUT, Host, noop, ResponseType, ServerErrors } from '..'
34
import { CoreAPIConstructorParamsType, FetchAPIParamsType, FetchInTimeParamsType } from './types'
45
import { handleServerError } from './utils'

src/Common/API/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ const dashboardAPI = new CoreAPI({
88
})
99

1010
export const { post, put, patch, get, trash } = dashboardAPI
11-
export { getIsRequestAborted, abortPreviousRequests, handleRedirectToLicenseActivation } from './utils'
1211
export { default as CoreAPI } from './CoreAPI'
12+
export { abortPreviousRequests, getIsRequestAborted, handleRedirectToLicenseActivation } from './utils'

src/Common/API/utils.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
import { ServerErrors } from '@Common/ServerError'
21
import { MutableRefObject } from 'react'
2+
33
import { URLS } from '@Common/Constants'
4+
import { ServerErrors } from '@Common/ServerError'
5+
46
import { RESPONSE_MESSAGES } from './constants'
57

68
export const handleServerError = async (contentType: string, response: Response) => {

src/Common/AddCDButton/utils.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616

1717
import { AddCDPositions, AddPipelineType, PipelineType, WorkflowNodeType } from '../Types'
18-
import { HandleAddCD, GetPipelineType } from './types'
18+
import { GetPipelineType, HandleAddCD } from './types'
1919

2020
const getPipelineType = ({ startNode }: GetPipelineType) => {
2121
if (startNode.type === WorkflowNodeType.WEBHOOK) {

src/Common/ClipboardButton/ClipboardButton.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,14 @@
1414
* limitations under the License.
1515
*/
1616

17-
import { useState, useEffect, useRef } from 'react'
17+
import { useEffect, useRef, useState } from 'react'
18+
1819
import Tooltip from '@Common/Tooltip/Tooltip'
20+
21+
import { ReactComponent as Check } from '../../Assets/Icon/ic-check.svg'
22+
import { ReactComponent as ICCopy } from '../../Assets/Icon/ic-copy.svg'
1923
import { copyToClipboard, noop, stopPropagation } from '../Helper'
2024
import ClipboardProps from './types'
21-
import { ReactComponent as ICCopy } from '../../Assets/Icon/ic-copy.svg'
22-
import { ReactComponent as Check } from '../../Assets/Icon/ic-check.svg'
2325

2426
/**
2527
* @param content - Content to be copied

src/Common/CodeEditor/CodeEditor.reducer.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
*/
1616

1717
import YAML from 'yaml'
18+
1819
import { noop, YAMLStringify } from '@Common/Helper'
20+
1921
import { MODES } from '../Constants'
2022
import { Action, CodeEditorInitialValueType, CodeEditorState } from './types'
2123
import { getCodeEditorThemeFromAppTheme } from './utils'

src/Common/CodeEditor/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616

1717
import { AppThemeType } from '@Shared/Providers'
18+
1819
import { MODES } from '../Constants'
1920

2021
export interface InformationBarProps {

0 commit comments

Comments
 (0)