Skip to content

Commit

Permalink
style: enable import/order rule
Browse files Browse the repository at this point in the history
  • Loading branch information
iiroj committed Nov 13, 2021
1 parent 2752f1a commit 08f52f6
Show file tree
Hide file tree
Showing 19 changed files with 56 additions and 19 deletions.
20 changes: 18 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,26 @@
"extends": ["eslint:recommended", "plugin:import/recommended", "prettier"],
"plugins": ["node", "import", "prettier"],
"rules": {
"import/order": [
"error",
{
"groups": [
"builtin",
"external",
"internal",
"parent",
"sibling",
"index",
"object",
"type"
],
"newlines-between": "always"
}
],
"no-console": "off",
"node/no-unsupported-features/node-builtins": "error",
"node/no-unsupported-features/es-syntax": ["error", { "ignores": ["modules"] }],
"node/no-unsupported-features/es-builtins": "error",
"node/no-unsupported-features/es-syntax": ["error", { "ignores": ["modules"] }],
"node/no-unsupported-features/node-builtins": "error",
"prettier/prettier": "error"
}
}
3 changes: 2 additions & 1 deletion bin/lint-staged.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/usr/bin/env node

import fs from 'fs'

import cmdline from 'commander'
import debug from 'debug'
import fs from 'fs'
import supportsColor from 'supports-color'

import lintStaged from '../lib/index.js'
Expand Down
3 changes: 2 additions & 1 deletion lib/chunkFiles.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import debug from 'debug'
import path from 'path'

import debug from 'debug'
import normalize from 'normalize-path'

const debugLog = debug('lint-staged:chunkFiles')
Expand Down
3 changes: 2 additions & 1 deletion lib/file.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import debug from 'debug'
import { promises as fs } from 'fs'

import debug from 'debug'

const debugLog = debug('lint-staged:file')

/**
Expand Down
3 changes: 2 additions & 1 deletion lib/generateTasks.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import path from 'path'

import debug from 'debug'
import micromatch from 'micromatch'
import path from 'path'
import normalize from 'normalize-path'

const debugLog = debug('lint-staged:generateTasks')
Expand Down
3 changes: 2 additions & 1 deletion lib/gitWorkflow.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import debug from 'debug'
import path from 'path'

import debug from 'debug'

import { execGit } from './execGit.js'
import { readFile, unlink, writeFile } from './file.js'
import {
Expand Down
3 changes: 2 additions & 1 deletion lib/resolveGitRepo.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import debug from 'debug'
import { promises as fs } from 'fs'
import path from 'path'

import debug from 'debug'
import normalize from 'normalize-path'

import { execGit } from './execGit.js'
Expand Down
3 changes: 2 additions & 1 deletion lib/validateOptions.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import debug from 'debug'
import { constants, promises as fs } from 'fs'

import debug from 'debug'

import { invalidOption } from './messages.js'
import { InvalidOptionsError } from './symbols.js'

Expand Down
3 changes: 2 additions & 1 deletion test/chunkFiles.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import normalize from 'normalize-path'
import path from 'path'

import normalize from 'normalize-path'

import { chunkFiles } from '../lib/chunkFiles'

describe('chunkFiles', () => {
Expand Down
1 change: 1 addition & 0 deletions test/execGit.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import path from 'path'

import execa from 'execa'

import { execGit, GIT_GLOBAL_OPTIONS } from '../lib/execGit'
Expand Down
3 changes: 2 additions & 1 deletion test/generateTasks.spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import normalize from 'normalize-path'
import os from 'os'
import path from 'path'

import normalize from 'normalize-path'

import { generateTasks } from '../lib/generateTasks'
import { resolveGitRepo } from '../lib/resolveGitRepo'

Expand Down
4 changes: 3 additions & 1 deletion test/gitWorkflow.spec.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import path from 'path'

import fs from 'fs-extra'
import normalize from 'normalize-path'
import path from 'path'

import { execGit as execGitBase } from '../lib/execGit'
import { writeFile } from '../lib/file'
import { GitWorkflow } from '../lib/gitWorkflow'
import { getInitialState } from '../lib/state'

import { createTempDir } from './utils/tempDir'
import { normalizeWindowsNewlines } from './utils/crossPlatform'

Expand Down
4 changes: 3 additions & 1 deletion test/index.spec.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import path from 'path'

import { cosmiconfig } from 'cosmiconfig'
import makeConsoleMock from 'consolemock'
import path from 'path'

jest.unmock('execa')

import { getStagedFiles } from '../lib/getStagedFiles'
import lintStaged from '../lib/index'
import { InvalidOptionsError } from '../lib/symbols'
import { validateOptions } from '../lib/validateOptions'

import { replaceSerializer } from './utils/replaceSerializer'

const mockCosmiconfigWith = (result) => {
Expand Down
3 changes: 2 additions & 1 deletion test/index2.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import path from 'path'

import { Listr } from 'listr2'
import makeConsoleMock from 'consolemock'
import path from 'path'

jest.mock('listr2')
jest.mock('../lib/resolveGitRepo')
Expand Down
4 changes: 3 additions & 1 deletion test/integration.test.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import path from 'path'

import makeConsoleMock from 'consolemock'
import fs from 'fs-extra'
import ansiSerializer from 'jest-snapshot-serializer-ansi'
import normalize from 'normalize-path'
import path from 'path'

jest.unmock('cosmiconfig')
jest.unmock('execa')

import { execGit as execGitBase } from '../lib/execGit'
import lintStaged from '../lib/index'

import { replaceSerializer } from './utils/replaceSerializer'
import { createTempDir } from './utils/tempDir'
import { isWindowsActions, normalizeWindowsNewlines } from './utils/crossPlatform'
Expand Down
3 changes: 2 additions & 1 deletion test/resolveGitRepo.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import normalize from 'normalize-path'
import path from 'path'

import normalize from 'normalize-path'

import { determineGitDir, resolveGitRepo } from '../lib/resolveGitRepo'

/**
Expand Down
3 changes: 2 additions & 1 deletion test/runAll.spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import path from 'path'

import makeConsoleMock from 'consolemock'
import execa from 'execa'
import normalize from 'normalize-path'
import path from 'path'

import { getStagedFiles } from '../lib/getStagedFiles'
import { GitWorkflow } from '../lib/gitWorkflow'
Expand Down
3 changes: 2 additions & 1 deletion test/utils/tempDir.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import fs from 'fs-extra'
import os from 'os'
import path from 'path'

import fs from 'fs-extra'

const osTmpDir = fs.realpathSync(process.env.RUNNER_TEMP || os.tmpdir())

/**
Expand Down
3 changes: 2 additions & 1 deletion test/validateOptions.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import makeConsoleMock from 'consolemock'
import { constants, promises as fs } from 'fs'

import makeConsoleMock from 'consolemock'

import { validateOptions } from '../lib/validateOptions'
import { InvalidOptionsError } from '../lib/symbols'

Expand Down

0 comments on commit 08f52f6

Please sign in to comment.