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: v12.0.0
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: v12.0.1
Choose a head ref
  • 1 commit
  • 1 file changed
  • 1 contributor

Commits on Nov 13, 2021

  1. fix: read version number from lint-staged package.json instead of pac…

    …kage.json in cwd (#1043) (#1044)
    
    If the package.json did not have a version number, it would cause lint-staged to crash.
    coalman authored Nov 13, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    9f9213d View commit details
Showing with 4 additions and 1 deletion.
  1. +4 −1 bin/lint-staged.js
5 changes: 4 additions & 1 deletion bin/lint-staged.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/usr/bin/env node

import fs from 'fs'
import path from 'path'
import { fileURLToPath } from 'url'

import cmdline from 'commander'
import debug from 'debug'
@@ -17,7 +19,8 @@ if (supportsColor.stdout) {
// Do not terminate main Listr process on SIGINT
process.on('SIGINT', () => {})

const packageJson = JSON.parse(fs.readFileSync('package.json'))
const packageJsonPath = path.join(fileURLToPath(import.meta.url), '../../package.json')
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath))
const version = packageJson.version

cmdline