Skip to content

Commit

Permalink
docs(changeset): feat(eslint): add comment tips
Browse files Browse the repository at this point in the history
  • Loading branch information
nailiable committed Nov 5, 2024
1 parent 4e8a0a3 commit af0ff57
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/wicked-pens-lie.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@nailyjs/eslint": patch
---

feat(eslint): add comment tips
27 changes: 27 additions & 0 deletions packages/eslint/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,33 @@ export function naily(...args: Parameters<typeof antfu>): ReturnType<typeof antf
}, ...args.slice(1))
}

/**
* Create a proxy to `naily.config.ts` for ESLint.
*
* @export
* @return {Promise<ReturnType<typeof antfu>>}
* @example
* In `eslint.config.js`:
*
* ```js
* import { nailyProxy } from '@nailyjs/eslint'
*
* export default await nailyProxy()
* ```
*
* Then you can define eslint config in `naily.config.ts`:
* ```ts
* import { defineConfig } from '@nailyjs/config'
*
* export default defineConfig({
* naily: {
* eslint: {
* // Your eslint config here
* }
* }
* })
* ```
*/
export async function nailyProxy(): Promise<ReturnType<typeof antfu>> {
return await new ESLintBootstrap()
.use(ConfigPlugin())
Expand Down
12 changes: 12 additions & 0 deletions packages/eslint/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@ declare global {
namespace Naily {
namespace Configuration {
interface NailyUserConfig {
/**
* Eslint config.
*
* If you want to define eslint config into this object, you must create `eslint.config.js` file in the root of your project,
* and add the following code:
* ```js
* import { nailyProxy } from '@nailyjs/eslint'
*
* export default await nailyProxy()
* ```
* It will proxy the config from `naily.config.ts` to this `naily.eslint` object.
*/
eslint?: Parameters<typeof antfu>[0] & {
extraOptions?: Array<Parameters<typeof antfu>[1]>
}
Expand Down

0 comments on commit af0ff57

Please sign in to comment.