Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: lint-staged/lint-staged
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v10.2.11
Choose a base ref
...
head repository: lint-staged/lint-staged
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v10.2.12
Choose a head ref
  • 5 commits
  • 6 files changed
  • 1 contributor

Commits on Jul 28, 2020

  1. fix: ensure supportsColor.level exists before stringifying it

    When supports-color detects a level of 0, it will not return an object containing the key `level`, but instead only `false`. This commit makes sure `supportsColor.level` exists before calling `supportsColor.level.toString()`.
    
    The TypeScript definitions of `chalk` seem wrong in this regard, since they imply that if `supportsColor` is truthy, it is an object and always contains the `level` key of type `0 | 1 | 2 | 3`.
    iiroj committed Jul 28, 2020
    Copy the full SHA
    aa9898e View commit details

Commits on Aug 24, 2020

  1. Copy the full SHA
    e0ee583 View commit details
  2. Copy the full SHA
    c7923ad View commit details
  3. Copy the full SHA
    7a5182b View commit details

Commits on Aug 25, 2020

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    10b3218 View commit details
Showing with 1,341 additions and 1,024 deletions.
  1. +1 −1 bin/lint-staged.js
  2. +1 −0 lib/gitWorkflow.js
  3. +17 −17 package.json
  4. +4 −7 test/integration.test.js
  5. +8 −1 test/runAll.spec.js
  6. +1,310 −998 yarn.lock
2 changes: 1 addition & 1 deletion bin/lint-staged.js
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@

// Force colors for packages that depend on https://www.npmjs.com/package/supports-color
const { supportsColor } = require('chalk')
if (supportsColor) {
if (supportsColor && supportsColor.level) {
process.env.FORCE_COLOR = supportsColor.level.toString()
}

1 change: 1 addition & 0 deletions lib/gitWorkflow.js
Original file line number Diff line number Diff line change
@@ -53,6 +53,7 @@ const GIT_DIFF_ARGS = [
'--src-prefix=a/', // force prefix for consistent behaviour
'--dst-prefix=b/', // force prefix for consistent behaviour
'--patch', // output a patch that can be applied
'--submodule=short', // always use the default short format for submodules
]
const GIT_APPLY_ARGS = ['-v', '--whitespace=nowarn', '--recount', '--unidiff-zero']

34 changes: 17 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
@@ -32,15 +32,15 @@
}
},
"dependencies": {
"chalk": "^4.0.0",
"cli-truncate": "2.1.0",
"commander": "^5.1.0",
"cosmiconfig": "^6.0.0",
"chalk": "^4.1.0",
"cli-truncate": "^2.1.0",
"commander": "^6.0.0",
"cosmiconfig": "^7.0.0",
"debug": "^4.1.1",
"dedent": "^0.7.0",
"enquirer": "^2.3.5",
"execa": "^4.0.1",
"listr2": "^2.1.0",
"enquirer": "^2.3.6",
"execa": "^4.0.3",
"listr2": "^2.6.0",
"log-symbols": "^4.0.0",
"micromatch": "^4.0.2",
"normalize-path": "^3.0.0",
@@ -49,22 +49,22 @@
"stringify-object": "^3.3.0"
},
"devDependencies": {
"@babel/core": "^7.9.6",
"@babel/plugin-proposal-object-rest-spread": "^7.9.6",
"@babel/preset-env": "^7.9.6",
"@babel/core": "^7.11.4",
"@babel/plugin-proposal-object-rest-spread": "^7.11.0",
"@babel/preset-env": "^7.11.0",
"babel-eslint": "10.1.0",
"babel-jest": "^26.0.1",
"babel-jest": "^26.3.0",
"consolemock": "^1.1.0",
"eslint": "^7.0.0",
"eslint": "^7.7.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^3.1.3",
"fs-extra": "^9.0.0",
"eslint-plugin-prettier": "^3.1.4",
"fs-extra": "^9.0.1",
"husky": "^4.2.5",
"jest": "^26.0.1",
"jest": "^26.4.2",
"jest-snapshot-serializer-ansi": "^1.0.0",
"prettier": "^2.0.5"
"prettier": "^2.1.0"
},
"config": {
"commitizen": {
11 changes: 4 additions & 7 deletions test/integration.test.js
Original file line number Diff line number Diff line change
@@ -489,13 +489,10 @@ describe('lint-staged', () => {

// Nothing is wrong, so a new commit is created and file is pretty
expect(await execGit(['rev-list', '--count', 'HEAD'])).toEqual('4')
expect(await execGit(['log', '-1', '--pretty=%B'])).toMatchInlineSnapshot(`
"Merge branch 'branch-b'
# Conflicts:
# test.js
"
`)
const log = await execGit(['log', '-1', '--pretty=%B'])
expect(log).toMatch(`Merge branch 'branch-b`)
expect(log).toMatch(`Conflicts:`)
expect(log).toMatch(`test.js`)
expect(await readFile('test.js')).toEqual(fileInBranchBFixed)
})

9 changes: 8 additions & 1 deletion test/runAll.spec.js
Original file line number Diff line number Diff line change
@@ -125,8 +125,13 @@ describe('runAll', () => {
LOG [STARTED] Preparing...
ERROR [FAILED] test
LOG [STARTED] Running tasks...
INFO [SKIPPED] Skipped because of previous git error.
LOG [STARTED] Applying modifications...
LOG [STARTED] Cleaning up..."
INFO [SKIPPED]
[SKIPPED] × lint-staged failed due to a git error.
LOG [STARTED] Cleaning up...
INFO [SKIPPED]
[SKIPPED] × lint-staged failed due to a git error."
`)
})

@@ -158,6 +163,7 @@ describe('runAll', () => {
ERROR [FAILED] echo \\"sample\\" [1]
LOG [SUCCESS] Running tasks...
LOG [STARTED] Applying modifications...
INFO [SKIPPED] Skipped because of errors from tasks.
LOG [STARTED] Reverting to original state because of errors...
LOG [SUCCESS] Reverting to original state because of errors...
LOG [STARTED] Cleaning up...
@@ -195,6 +201,7 @@ describe('runAll', () => {
ERROR [FAILED] echo \\"sample\\" [SIGINT]
LOG [SUCCESS] Running tasks...
LOG [STARTED] Applying modifications...
INFO [SKIPPED] Skipped because of errors from tasks.
LOG [STARTED] Reverting to original state because of errors...
LOG [SUCCESS] Reverting to original state because of errors...
LOG [STARTED] Cleaning up...
2,308 changes: 1,310 additions & 998 deletions yarn.lock

Large diffs are not rendered by default.