Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: add eslint sort import rule #767

Merged
merged 4 commits into from
Jan 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,17 @@ module.exports = {
'wrap-iife': 'off',
'wrap-regex': 'off',
'yield-star-spacing': 'off',
'import/order': [
'error',
{
alphabetize: {
order: 'asc',
caseInsensitive: false,
},
groups: ['builtin', 'external', 'parent', 'index', 'sibling'],
'newlines-between': 'always',
},
],
},
env: {
browser: false,
Expand Down
7 changes: 4 additions & 3 deletions __tests__/functional/delta.nut.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
'use strict'
import { expect } from '@salesforce/command/lib/test'
import { execCmd } from '@salesforce/cli-plugins-testkit'
import readline from 'readline'
import fs from 'fs'
import readline from 'readline'

import { execCmd } from '@salesforce/cli-plugins-testkit'
import { expect } from '@salesforce/command/lib/test'

describe('sgd:source:delta NUTS', () => {
it('run help', () => {
Expand Down
3 changes: 2 additions & 1 deletion __tests__/functional/main.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
;`use strict`
import { expect, jest, describe, it } from '@jest/globals'

// eslint-disable-next-line @typescript-eslint/no-var-requires
const sgd = require('../../src/main')
import { expect, jest, describe, it } from '@jest/globals'

const mockValidateConfig = jest.fn()
jest.mock('../../src/utils/cliHelper', () => {
Expand Down
9 changes: 5 additions & 4 deletions __tests__/integration/services.test.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
'use strict'
import { expect, jest, describe, it } from '@jest/globals'
import { getGlobalMetadata } from '../__utils__/globalTestHelper'

import {
ADDITION,
DELETION,
MODIFICATION,
} from '../../src/constant/gitConstants'
import { readPathFromGit } from '../../src/utils/fsHelper'
import { Work } from '../../src/types/work'
import TypeHandlerFactory from '../../src/service/typeHandlerFactory'
import { MetadataRepository } from '../../src/metadata/MetadataRepository'
import TypeHandlerFactory from '../../src/service/typeHandlerFactory'
import { Work } from '../../src/types/work'
import { readPathFromGit } from '../../src/utils/fsHelper'
import { getGlobalMetadata } from '../__utils__/globalTestHelper'

jest.mock('../../src/utils/fsHelper')

Expand Down
9 changes: 5 additions & 4 deletions __tests__/unit/lib/adapter/GitAdapter.test.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
'use strict'
import { expect, jest, describe, it } from '@jest/globals'
import { getWork } from '../../../__utils__/globalTestHelper'
import { Config } from '../../../../src/types/config'
import { readFile } from 'fs-extra'
import { WalkerEntry, WalkerIterateCallback } from 'isomorphic-git'

import GitAdapter, {
contentWalker,
diffLineWalker,
filePathWalker,
iterate,
} from '../../../../src/adapter/GitAdapter'
import { Config } from '../../../../src/types/config'
import {
getLFSObjectContentPath,
isLFS,
} from '../../../../src/utils/gitLfsHelper'
import { readFile } from 'fs-extra'
import { WalkerEntry, WalkerIterateCallback } from 'isomorphic-git'
import { getWork } from '../../../__utils__/globalTestHelper'

const mockedDirExists = jest.fn()
const mockedFileExists = jest.fn()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
'use strict'
import { expect, describe, it } from '@jest/globals'
import { MetadataRepositoryImpl } from '../../../../src/metadata/MetadataRepositoryImpl'

import { MetadataRepository } from '../../../../src/metadata/MetadataRepository'
import { MetadataRepositoryImpl } from '../../../../src/metadata/MetadataRepositoryImpl'
import { Metadata } from '../../../../src/types/metadata'

describe('MetadataRepositoryImpl', () => {
Expand Down
3 changes: 2 additions & 1 deletion __tests__/unit/lib/metadata/metadataManager.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
'use strict'
import { expect, describe, it } from '@jest/globals'

import { MetadataRepositoryImpl } from '../../../../src/metadata/MetadataRepositoryImpl'
import {
getDefinition,
getInFileAttributes,
Expand All @@ -8,7 +10,6 @@ import {
isVersionSupported,
} from '../../../../src/metadata/metadataManager'
import { Metadata } from '../../../../src/types/metadata'
import { MetadataRepositoryImpl } from '../../../../src/metadata/MetadataRepositoryImpl'

describe(`test if metadata`, () => {
it('provide latest when apiVersion does not exist', async () => {
Expand Down
5 changes: 3 additions & 2 deletions __tests__/unit/lib/post-processor/baseProcessor.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
'use strict'
import { beforeAll, expect, describe, it } from '@jest/globals'
import { getGlobalMetadata, getWork } from '../../../__utils__/globalTestHelper'

import { MetadataRepository } from '../../../../src/metadata/MetadataRepository'
import BaseProcessor from '../../../../src/post-processor/baseProcessor'
import { Work } from '../../../../src/types/work'
import { MetadataRepository } from '../../../../src/metadata/MetadataRepository'
import { getGlobalMetadata, getWork } from '../../../__utils__/globalTestHelper'

describe('BaseProcessor', () => {
let work: Work, metadata: MetadataRepository
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
'use strict'
import { expect, jest, describe, it } from '@jest/globals'
import { getGlobalMetadata, getWork } from '../../../__utils__/globalTestHelper'
import { pathExists } from 'fs-extra'
import FlowTranslationProcessor from '../../../../src/post-processor/flowTranslationProcessor'
import { parseXmlFileToJson } from '../../../../src/utils/fxpHelper'

import {
FLOW_XML_NAME,
TRANSLATION_TYPE,
} from '../../../../src/constant/metadataConstants'
import { isSubDir, readFile, treatPathSep } from '../../../../src/utils/fsUtils'
import { writeFile, readDir } from '../../../../src/utils/fsHelper'
import { Work } from '../../../../src/types/work'
import { MetadataRepository } from '../../../../src/metadata/MetadataRepository'
import FlowTranslationProcessor from '../../../../src/post-processor/flowTranslationProcessor'
import { Work } from '../../../../src/types/work'
import { writeFile, readDir } from '../../../../src/utils/fsHelper'
import { isSubDir, readFile, treatPathSep } from '../../../../src/utils/fsUtils'
import { parseXmlFileToJson } from '../../../../src/utils/fxpHelper'
import { getGlobalMetadata, getWork } from '../../../__utils__/globalTestHelper'

jest.mock('fs-extra')
jest.mock('../../../../src/utils/fsHelper')
Expand Down
7 changes: 4 additions & 3 deletions __tests__/unit/lib/post-processor/includeProcessor.test.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
'use strict'
import { expect, jest, describe, it } from '@jest/globals'
import { getGlobalMetadata, getWork } from '../../../__utils__/globalTestHelper'

import { MetadataRepository } from '../../../../src/metadata/MetadataRepository'
import IncludeProcessor from '../../../../src/post-processor/includeProcessor'
import { Work } from '../../../../src/types/work'
import {
IgnoreHelper,
buildIncludeHelper,
} from '../../../../src/utils/ignoreHelper'
import { Work } from '../../../../src/types/work'
import { MetadataRepository } from '../../../../src/metadata/MetadataRepository'
import { getGlobalMetadata, getWork } from '../../../__utils__/globalTestHelper'

const mockProcess = jest.fn()
jest.mock('../../../../src/service/diffLineInterpreter', () => {
Expand Down
7 changes: 4 additions & 3 deletions __tests__/unit/lib/post-processor/packageGenerator.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
'use strict'
import { expect, jest, describe, it } from '@jest/globals'
import { getGlobalMetadata, getWork } from '../../../__utils__/globalTestHelper'
import PackageGenerator from '../../../../src/post-processor/packageGenerator'
import fse from 'fs-extra'
import { Work } from '../../../../src/types/work'

import { MetadataRepository } from '../../../../src/metadata/MetadataRepository'
import PackageGenerator from '../../../../src/post-processor/packageGenerator'
import { Work } from '../../../../src/types/work'
import { getGlobalMetadata, getWork } from '../../../__utils__/globalTestHelper'

jest.mock('fs-extra')

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
'use strict'
import { expect, jest, describe, it } from '@jest/globals'
import { getGlobalMetadata, getWork } from '../../../__utils__/globalTestHelper'

import { MetadataRepository } from '../../../../src/metadata/MetadataRepository'
import BaseProcessor from '../../../../src/post-processor/baseProcessor'
import PostProcessorManager, {
getPostProcessors,
} from '../../../../src/post-processor/postProcessorManager'
import BaseProcessor from '../../../../src/post-processor/baseProcessor'
import { Work } from '../../../../src/types/work'
import { MetadataRepository } from '../../../../src/metadata/MetadataRepository'
import { getGlobalMetadata, getWork } from '../../../__utils__/globalTestHelper'

const processSpy = jest.fn()

Expand Down
7 changes: 4 additions & 3 deletions __tests__/unit/lib/service/botHandler.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
'use strict'
import { expect, jest, describe, it } from '@jest/globals'
import { getGlobalMetadata, getWork } from '../../../__utils__/globalTestHelper'

import { MetadataRepository } from '../../../../src/metadata/MetadataRepository'
import BotHandler from '../../../../src/service/botHandler'
import { copyFiles } from '../../../../src/utils/fsHelper'
import { Work } from '../../../../src/types/work'
import { MetadataRepository } from '../../../../src/metadata/MetadataRepository'
import { copyFiles } from '../../../../src/utils/fsHelper'
import { getGlobalMetadata, getWork } from '../../../__utils__/globalTestHelper'

jest.mock('../../../../src/utils/fsHelper')

Expand Down
9 changes: 5 additions & 4 deletions __tests__/unit/lib/service/customObjectHandler.test.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
'use strict'
import { expect, jest, describe, it } from '@jest/globals'
import { getGlobalMetadata, getWork } from '../../../__utils__/globalTestHelper'
import CustomObjectHandler from '../../../../src/service/customObjectHandler'

import { MASTER_DETAIL_TAG } from '../../../../src/constant/metadataConstants'
import { MetadataRepository } from '../../../../src/metadata/MetadataRepository'
import CustomObjectHandler from '../../../../src/service/customObjectHandler'
import { Work } from '../../../../src/types/work'
import {
copyFiles,
pathExists,
readDir,
readPathFromGit,
} from '../../../../src/utils/fsHelper'
import { Work } from '../../../../src/types/work'
import { MetadataRepository } from '../../../../src/metadata/MetadataRepository'
import { getGlobalMetadata, getWork } from '../../../__utils__/globalTestHelper'

jest.mock('../../../../src/utils/fsHelper')

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
'use strict'

import { expect, jest, describe, it } from '@jest/globals'
import { getGlobalMetadata, getWork } from '../../../__utils__/globalTestHelper'

import { MetadataRepository } from '../../../../src/metadata/MetadataRepository'
import DiffLineInterpreter from '../../../../src/service/diffLineInterpreter'
import { Work } from '../../../../src/types/work'
import { MetadataRepository } from '../../../../src/metadata/MetadataRepository'
import { getGlobalMetadata, getWork } from '../../../__utils__/globalTestHelper'

jest.mock('os', () => ({
availableParallelism: null,
Expand Down
5 changes: 3 additions & 2 deletions __tests__/unit/lib/service/diffLineInterpreter.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
'use strict'
import { expect, jest, describe, it } from '@jest/globals'
import { getGlobalMetadata, getWork } from '../../../__utils__/globalTestHelper'

import { MetadataRepository } from '../../../../src/metadata/MetadataRepository'
import DiffLineInterpreter from '../../../../src/service/diffLineInterpreter'
import { Work } from '../../../../src/types/work'
import { MetadataRepository } from '../../../../src/metadata/MetadataRepository'
import { getGlobalMetadata, getWork } from '../../../__utils__/globalTestHelper'

const mockHandle = jest.fn()
jest.mock('../../../../src/service/typeHandlerFactory', () => {
Expand Down
5 changes: 3 additions & 2 deletions __tests__/unit/lib/service/inBundleHandler.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
'use strict'
import { expect, jest, describe, it } from '@jest/globals'
import { getGlobalMetadata, getWork } from '../../../__utils__/globalTestHelper'

import { MetadataRepository } from '../../../../src/metadata/MetadataRepository'
import InBundleHandler from '../../../../src/service/inBundleHandler'
import { Work } from '../../../../src/types/work'
import { MetadataRepository } from '../../../../src/metadata/MetadataRepository'
import { getGlobalMetadata, getWork } from '../../../__utils__/globalTestHelper'

const objectType = 'digitalExperiences'
const entityPath =
Expand Down
9 changes: 5 additions & 4 deletions __tests__/unit/lib/service/inFileHandler.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
'use strict'
import { expect, jest, describe, it } from '@jest/globals'
import { getGlobalMetadata, getWork } from '../../../__utils__/globalTestHelper'
import { writeFile } from '../../../../src/utils/fsHelper'
import { Work } from '../../../../src/types/work'
import InFileHandler from '../../../../src/service/inFileHandler'

import { MetadataRepository } from '../../../../src/metadata/MetadataRepository'
import InFileHandler from '../../../../src/service/inFileHandler'
import { Work } from '../../../../src/types/work'
import { writeFile } from '../../../../src/utils/fsHelper'
import { getGlobalMetadata, getWork } from '../../../__utils__/globalTestHelper'

const mockCompare = jest.fn()
const mockPrune = jest.fn()
Expand Down
9 changes: 5 additions & 4 deletions __tests__/unit/lib/service/inFolderHandler.test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
'use strict'
import { expect, jest, describe, it } from '@jest/globals'
import { getGlobalMetadata, getWork } from '../../../__utils__/globalTestHelper'
import InFolder from '../../../../src/service/inFolderHandler'
import { copyFiles, readDir } from '../../../../src/utils/fsHelper'

import { METAFILE_SUFFIX } from '../../../../src/constant/metadataConstants'
import { Work } from '../../../../src/types/work'
import { MetadataRepository } from '../../../../src/metadata/MetadataRepository'
import InFolder from '../../../../src/service/inFolderHandler'
import { Work } from '../../../../src/types/work'
import { copyFiles, readDir } from '../../../../src/utils/fsHelper'
import { getGlobalMetadata, getWork } from '../../../__utils__/globalTestHelper'

jest.mock('../../../../src/utils/fsHelper')
const mockedReadDir = jest.mocked(readDir)
Expand Down
7 changes: 4 additions & 3 deletions __tests__/unit/lib/service/inResourceHandler.test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
'use strict'
import { expect, jest, describe, it } from '@jest/globals'
import { getGlobalMetadata, getWork } from '../../../__utils__/globalTestHelper'

import { METAFILE_SUFFIX } from '../../../../src/constant/metadataConstants'
import { MetadataRepository } from '../../../../src/metadata/MetadataRepository'
import InResourceHandler from '../../../../src/service/inResourceHandler'
import { Work } from '../../../../src/types/work'
import { copyFiles, pathExists, readDir } from '../../../../src/utils/fsHelper'
import { METAFILE_SUFFIX } from '../../../../src/constant/metadataConstants'
import { MetadataRepository } from '../../../../src/metadata/MetadataRepository'
import { getGlobalMetadata, getWork } from '../../../__utils__/globalTestHelper'

jest.mock('../../../../src/utils/fsHelper')

Expand Down
9 changes: 5 additions & 4 deletions __tests__/unit/lib/service/lwcHandler.test.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
'use strict'
import { expect, jest, describe, it } from '@jest/globals'
import { getGlobalMetadata, getWork } from '../../../__utils__/globalTestHelper'
import LwcHandler from '../../../../src/service/lwcHandler'
import { copyFiles } from '../../../../src/utils/fsHelper'
import { Work } from '../../../../src/types/work'

import {
ADDITION,
DELETION,
MODIFICATION,
} from '../../../../src/constant/gitConstants'
import { MetadataRepository } from '../../../../src/metadata/MetadataRepository'
import LwcHandler from '../../../../src/service/lwcHandler'
import { Work } from '../../../../src/types/work'
import { copyFiles } from '../../../../src/utils/fsHelper'
import { getGlobalMetadata, getWork } from '../../../__utils__/globalTestHelper'

jest.mock('../../../../src/utils/fsHelper')

Expand Down
7 changes: 4 additions & 3 deletions __tests__/unit/lib/service/objectTranslationHandler.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
'use strict'
import { expect, jest, describe, it } from '@jest/globals'
import { getGlobalMetadata, getWork } from '../../../__utils__/globalTestHelper'
import { Work } from '../../../../src/types/work'

import { MetadataRepository } from '../../../../src/metadata/MetadataRepository'
import ObjectTranslation from '../../../../src/service/objectTranslationHandler'
import { Work } from '../../../../src/types/work'
import { writeFile, copyFiles } from '../../../../src/utils/fsHelper'
import { MetadataRepository } from '../../../../src/metadata/MetadataRepository'
import { getGlobalMetadata, getWork } from '../../../__utils__/globalTestHelper'

const mockCompare = jest.fn()
const mockprune = jest.fn()
Expand Down
9 changes: 5 additions & 4 deletions __tests__/unit/lib/service/sharedFolderHandler.test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
'use strict'
import { expect, jest, describe, it } from '@jest/globals'
import { getGlobalMetadata, getWork } from '../../../__utils__/globalTestHelper'
import SharedFolderHandler from '../../../../src/service/sharedFolderHandler'
import { copyFiles } from '../../../../src/utils/fsHelper'

import { METAFILE_SUFFIX } from '../../../../src/constant/metadataConstants'
import { Work } from '../../../../src/types/work'
import { MetadataRepository } from '../../../../src/metadata/MetadataRepository'
import SharedFolderHandler from '../../../../src/service/sharedFolderHandler'
import { Work } from '../../../../src/types/work'
import { copyFiles } from '../../../../src/utils/fsHelper'
import { getGlobalMetadata, getWork } from '../../../__utils__/globalTestHelper'

jest.mock('../../../../src/utils/fsHelper')

Expand Down
Loading
Loading