Skip to content

Commit

Permalink
chore: add types to gitignore.ts (#6527)
Browse files Browse the repository at this point in the history
Co-authored-by: lemusthelroy <lewis.john.thorley@gmail.com>
Co-authored-by: Sarah Etter <sarah.etter@netlify.com>
  • Loading branch information
3 people committed May 2, 2024
1 parent 9e4b616 commit 407d246
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
19 changes: 19 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Expand Up @@ -193,6 +193,7 @@
"@types/jsonwebtoken": "9.0.6",
"@types/node": "20.9.0",
"@types/node-fetch": "2.6.11",
"@types/parse-gitignore": "^1.0.2",
"@types/prettyjson": "0.0.33",
"@types/semver": "7.5.8",
"@types/uuid": "9.0.8",
Expand Down
8 changes: 2 additions & 6 deletions src/utils/gitignore.ts
@@ -1,22 +1,19 @@
import { readFile, writeFile } from 'fs/promises'
import path from 'path'

// @ts-expect-error TS(7016) FIXME: Could not find a declaration file for module 'pars... Remove this comment to see the full error message
import parseIgnore from 'parse-gitignore'

import { fileExistsAsync } from '../lib/fs.js'

import { log } from './command-helpers.js'

// @ts-expect-error TS(7006) FIXME: Parameter 'dir' implicitly has an 'any' type.
const hasGitIgnore = async function (dir) {
const hasGitIgnore = async function (dir: string) {
const gitIgnorePath = path.join(dir, '.gitignore')
const hasIgnore = await fileExistsAsync(gitIgnorePath)
return hasIgnore
}

// @ts-expect-error TS(7006) FIXME: Parameter 'dir' implicitly has an 'any' type.
export const ensureNetlifyIgnore = async function (dir) {
export const ensureNetlifyIgnore = async function (dir: string) {
const gitIgnorePath = path.join(dir, '.gitignore')
const ignoreContent = '# Local Netlify folder\n.netlify\n'

Expand All @@ -35,7 +32,6 @@ export const ensureNetlifyIgnore = async function (dir) {
// ignore
}
/* Not ignoring .netlify folder. Add to .gitignore */
// @ts-expect-error TS(7006) FIXME: Parameter 'pattern' implicitly has an 'any' type.
if (!ignorePatterns || !ignorePatterns.patterns.some((pattern) => /(^|\/|\\)\.netlify($|\/|\\)/.test(pattern))) {
log()
log('Adding local .netlify folder to .gitignore file...')
Expand Down

1 comment on commit 407d246

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📊 Benchmark results

  • Dependency count: 1,329
  • Package size: 310 MB
  • Number of ts-expect-error directives: 997

Please sign in to comment.