-
-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: migrate code base to TypeScript (#175)
- Loading branch information
Showing
37 changed files
with
13,231 additions
and
4,696 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"pretty-quick": minor | ||
--- | ||
|
||
feat: migrate code base to TypeScript |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
dist | ||
node_modules | ||
test-dist | ||
*.log | ||
/.yarn/* | ||
!/.yarn/plugins | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = require('@1stg/lint-staged/tsc') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
coverage | ||
dist | ||
test-dist | ||
/.yarn |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = require('@1stg/simple-git-hooks') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import path from 'path' | ||
|
||
export = { | ||
format: jest.fn((input: string) => 'formatted:' + input), | ||
resolveConfig: { | ||
sync: jest.fn((file: string) => ({ file })), | ||
}, | ||
getFileInfo: { | ||
sync: jest.fn((file: string) => { | ||
const ext = path.extname(file) | ||
if (ext === '.js' || ext === '.md') { | ||
return { ignored: false, inferredParser: 'babel' } | ||
} | ||
return { ignored: false, inferredParser: null } | ||
}), | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,76 +1,3 @@ | ||
#!/usr/bin/env node | ||
// ! warning: this file is only here for compatibility, you should change to use `dist/cli.js` directly instead | ||
|
||
'use strict' | ||
|
||
const chalk = require('chalk') | ||
const mri = require('mri') | ||
|
||
const prettyQuick = require('..').default | ||
|
||
const args = mri(process.argv.slice(2), { | ||
alias: { | ||
'resolve-config': 'resolveConfig', | ||
'ignore-path': 'ignorePath', | ||
}, | ||
}) | ||
|
||
const prettyQuickResult = prettyQuick( | ||
process.cwd(), | ||
Object.assign({}, args, { | ||
onFoundSinceRevision: (scm, revision) => { | ||
console.log( | ||
`🔍 Finding changed files since ${chalk.bold( | ||
scm, | ||
)} revision ${chalk.bold(revision)}.`, | ||
) | ||
}, | ||
|
||
onFoundChangedFiles: changedFiles => { | ||
console.log( | ||
`🎯 Found ${chalk.bold(changedFiles.length)} changed ${ | ||
changedFiles.length === 1 ? 'file' : 'files' | ||
}.`, | ||
) | ||
}, | ||
|
||
onPartiallyStagedFile: file => { | ||
console.log(`✗ Found ${chalk.bold('partially')} staged file ${file}.`) | ||
}, | ||
|
||
onWriteFile: file => { | ||
console.log(`✍️ Fixing up ${chalk.bold(file)}.`) | ||
}, | ||
|
||
onCheckFile: (file, isFormatted) => { | ||
if (!isFormatted) { | ||
console.log(`⛔️ Check failed: ${chalk.bold(file)}`) | ||
} | ||
}, | ||
|
||
onExamineFile: file => { | ||
console.log(`🔍 Examining ${chalk.bold(file)}.`) | ||
}, | ||
}), | ||
) | ||
|
||
if (prettyQuickResult.success) { | ||
console.log('✅ Everything is awesome!') | ||
} else { | ||
if (prettyQuickResult.errors.indexOf('PARTIALLY_STAGED_FILE') !== -1) { | ||
console.log( | ||
'✗ Partially staged files were fixed up.' + | ||
` ${chalk.bold('Please update stage before committing')}.`, | ||
) | ||
} | ||
if (prettyQuickResult.errors.indexOf('BAIL_ON_WRITE') !== -1) { | ||
console.log( | ||
'✗ File had to be prettified and prettyQuick was set to bail mode.', | ||
) | ||
} | ||
if (prettyQuickResult.errors.indexOf('CHECK_FAILED') !== -1) { | ||
console.log( | ||
'✗ Code style issues found in the above file(s). Forgot to run Prettier?', | ||
) | ||
} | ||
process.exit(1) // ensure git hooks abort | ||
} | ||
module.exports = require('../dist/cli') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import '@total-typescript/ts-reset' |
Oops, something went wrong.