Skip to content

Commit 8b3b9a0

Browse files
committed
chore: add prettier
1 parent 683c441 commit 8b3b9a0

File tree

4 files changed

+23
-13
lines changed

4 files changed

+23
-13
lines changed

index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { join } from 'path';
2-
import { CompilerOptions, findConfigFile, nodeModuleNameResolver, sys } from 'typescript';
32
import { Plugin } from 'rollup';
3+
import { CompilerOptions, findConfigFile, nodeModuleNameResolver, sys } from 'typescript';
44

55
export const typescriptPaths = ({
66
tsConfigPath = findConfigFile('./', sys.fileExists),
@@ -16,7 +16,7 @@ export const typescriptPaths = ({
1616
return null;
1717
}
1818

19-
const hasMatchingPath = Object.keys(compilerOptions.paths).some(path =>
19+
const hasMatchingPath = Object.keys(compilerOptions.paths).some((path) =>
2020
new RegExp(path.replace('*', '\\w*')).test(importee),
2121
);
2222

package.json

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
"homepage": "https://github.com/simonhaenisch/rollup-plugin-typescript-paths#readme",
2323
"devDependencies": {
2424
"@types/node": "14.14.41",
25+
"prettier": "2.2.1",
26+
"prettier-plugin-organize-imports": "1.1.1",
2527
"rollup": "2.45.2",
2628
"typescript": "4.2.4"
2729
},
@@ -34,6 +36,17 @@
3436
"tabWidth": 2,
3537
"trailingComma": "all",
3638
"useTabs": true,
37-
"bracketSpacing": true
39+
"bracketSpacing": true,
40+
"overrides": [
41+
{
42+
"files": [
43+
"package.json",
44+
"*.md"
45+
],
46+
"options": {
47+
"useTabs": false
48+
}
49+
}
50+
]
3851
}
3952
}

readme.md

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Rollup Plugin to automatically resolve path aliases set in the `compilerOptions`
66

77
Don't use it if you're already using [rollup-plugin-typescript](https://github.com/rollup/rollup-plugin-typescript). This plugin is only for use cases where your TypeScript code has already been transpiled before `rollup` runs.
88

9-
For example, if you have
9+
For example, if you have
1010

1111
```js
1212
// tsconfig.json
@@ -46,19 +46,16 @@ import { typescriptPaths } from 'rollup-plugin-typescript-paths';
4646

4747
export default {
4848
// ...
49-
plugins: [
50-
typescriptPaths()
51-
]
52-
}
49+
plugins: [typescriptPaths()],
50+
};
5351
```
5452

5553
## Options
5654

57-
* **`tsConfigPath`:** Custom path to your `tsconfig.json`. Use this if the plugin can't seem to find the correct one by itself.
58-
* **`absolute`:** Whether to resolve to absolute paths or not; defaults to `true`.
59-
* **`transform`:** If the plugin successfully resolves a path, this function allows you to hook into the process and transform that path before it is returned.
55+
- **`tsConfigPath`:** Custom path to your `tsconfig.json`. Use this if the plugin can't seem to find the correct one by itself.
56+
- **`absolute`:** Whether to resolve to absolute paths or not; defaults to `true`.
57+
- **`transform`:** If the plugin successfully resolves a path, this function allows you to hook into the process and transform that path before it is returned.
6058

6159
## License
6260

6361
[MIT](/license).
64-

test/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const { strictEqual } = require('assert');
44
const { resolve, join } = require('path');
55
const typescriptPaths = require('../dist').default;
66

7-
const transform = path => path.replace(/\.js$/i, '.cjs.js');
7+
const transform = (path) => path.replace(/\.js$/i, '.cjs.js');
88

99
const plugin = typescriptPaths({ tsConfigPath: resolve(__dirname, 'tsconfig.json') });
1010
const pluginNonAbs = typescriptPaths({ tsConfigPath: resolve(__dirname, 'tsconfig.json'), absolute: false });

0 commit comments

Comments
 (0)