Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

style: lint fix #64

Merged
merged 11 commits into from
Mar 7, 2024
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@
Returns:

```ts
type TsconfigResult = {

Check warning on line 43 in README.md

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest)

'TsconfigResult' is defined but never used. Allowed unused vars must match /^_/u

/**
* The path to the tsconfig.json file
*/
Expand Down Expand Up @@ -140,7 +141,7 @@
Given a `tsconfig.json` file, it returns a file-matcher function that determines whether it should apply to a file path.

```ts
type FileMatcher = (filePath: string) => TsconfigResult['config'] | undefined

Check warning on line 144 in README.md

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest)

'FileMatcher' is defined but never used. Allowed unused vars must match /^_/u
```

#### tsconfig
Expand Down Expand Up @@ -168,7 +169,7 @@
* undefined if not
*/
const configForFile = fileMatcher?.('/path/to/file.ts')
const distCode = compileTypescript({

Check warning on line 172 in README.md

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest)

'distCode' is assigned a value but never used. Allowed unused vars must match /^_/u
code: sourceCode,
tsconfig: configForFile
})
Expand All @@ -182,7 +183,7 @@

The matcher function accepts an [import specifier (the path to resolve)](https://nodejs.org/api/esm.html#terminology), checks it against `compilerOptions.paths`, and returns an array of possible paths to check:
```ts
function pathsMatcher(specifier: string): string[]

Check warning on line 186 in README.md

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest)

'pathsMatcher' is defined but never used. Allowed unused vars must match /^_/u
```

This function only returns possible paths and doesn't actually do any resolution. This helps increase compatibility wtih file/build systems which usually have their own resolvers.
Expand All @@ -195,9 +196,9 @@
const tsconfig = getTsconfig()
const pathsMatcher = createPathsMatcher(tsconfig)

function exampleResolver(request: string) {
const exampleResolver = (request: string) => {

Check warning on line 199 in README.md

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest)

'exampleResolver' is assigned a value but never used. Allowed unused vars must match /^_/u
if (pathsMatcher) {
const tryPaths = pathsMatcher(request)

Check warning on line 201 in README.md

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest)

'tryPaths' is assigned a value but never used. Allowed unused vars must match /^_/u

// Check if paths in `tryPaths` exist
}
Expand Down Expand Up @@ -226,7 +227,7 @@
const tsconfigFile = readConfigFile(tsconfigPath, tsSys.readFile)

// Resolve extends
const parsedTsconfig = parseJsonConfigFileContent(

Check warning on line 230 in README.md

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest)

'parsedTsconfig' is assigned a value but never used. Allowed unused vars must match /^_/u
tsconfigFile.config,
tsSys,
path.dirname(tsconfigPath)
Expand Down
30 changes: 4 additions & 26 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
"name": "Hiroki Osame",
"email": "hiroki.osame@gmail.com"
},
"type": "module",
"files": [
"dist"
],
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.mjs",
"types": "./dist/index.d.cts",
Expand All @@ -41,7 +41,7 @@
}
},
"scripts": {
"lint": "eslint --cache .",
"lint": "lint --cache --node --ignore-pattern tests/fixtures .",
"build": "pkgroll --minify --target node12.20",
"test": "pnpm build && tsx tests",
"dev": "tsx watch --conditions=development tests",
Expand All @@ -52,11 +52,11 @@
"resolve-pkg-maps": "^1.0.0"
},
"devDependencies": {
"@pvtnbr/eslint-config": "^0.33.0",
"@pvtnbr/eslint-config": "^1.0.3",
"@types/node": "^18.15.10",
"@yarnpkg/pnp": "3.3.1",
"clean-pkg-json": "^1.2.0",
"eslint": "^8.36.0",
"eslint": "^8.57.0",
"execa": "^8.0.1",
"fs-fixture": "^1.2.0",
"is-fs-case-sensitive": "^1.0.0",
Expand All @@ -67,27 +67,5 @@
"tsx": "^4.7.0",
"type-fest": "^4.8.3",
"typescript": "^5.0.4"
},
"eslintConfig": {
"extends": "@pvtnbr/eslint-config",
"ignorePatterns": [
"tests/fixtures"
],
"overrides": [
{
"files": "tests/**/*.ts",
"rules": {
"@typescript-eslint/no-shadow": [
"error",
{
"allow": [
"test",
"describe"
]
}
]
}
}
]
}
}
Loading
Loading