Skip to content

Commit d999368

Browse files
authored
feat: first blood, should just work (#2)
1 parent 1254181 commit d999368

21 files changed

+512
-117
lines changed

.changeset/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"changelog": [
44
"@changesets/changelog-github",
55
{
6-
"repo": "un-ts/lib-boilerplate"
6+
"repo": "un-ts/eslint-import-context"
77
}
88
],
99
"commit": false,

.changeset/yellow-ducks-fold.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"eslint-import-context": minor
3+
---
4+
5+
feat: first blood, should just work

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ jobs:
1717
- 18
1818
- 20
1919
- 22
20+
- 24
2021
os:
2122
- macos-latest
2223
- windows-latest

.github/workflows/pkg-pr-new.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ jobs:
2828
run: yarn build
2929

3030
- name: Publish
31-
run: yarn dlx pkg-pr-new publish --compact
31+
run: yarn dlx pkg-pr-new publish # --compact

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ jobs:
3737
- name: Create Release Pull Request or Publish to npm
3838
uses: changesets/action@v1
3939
with:
40-
commit: 'chore: release lib-boilerplate'
41-
title: 'chore: release lib-boilerplate'
40+
commit: 'chore: release eslint-import-context'
41+
title: 'chore: release eslint-import-context'
4242
version: yarn run version
4343
publish: yarn release
4444
env:

.size-limit.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[
22
{
3-
"path": "./lib/index.js",
4-
"limit": "50B"
3+
"path": "./src/index.ts",
4+
"limit": "200B"
55
}
66
]

CHANGELOG.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1 @@
11
# Change Log
2-
3-
## 0.0.1
4-
5-
### Patch Changes
6-
7-
- [#83](https://github.com/un-ts/lib-boilerplate/pull/83) [`34771e4`](https://github.com/un-ts/lib-boilerplate/commit/34771e46fbf5de4c0448d5e9017c10704aef9cd1) Thanks [@JounQin](https://github.com/JounQin)! - chore: migrate to premove and tsdown

README.md

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
# lib-boilerplate
1+
# eslint-import-context
22

3-
[![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/un-ts/lib-boilerplate/ci.yml?branch=main)](https://github.com/un-ts/lib-boilerplate/actions/workflows/ci.yml?query=branch%3Amain)
4-
[![Codecov](https://img.shields.io/codecov/c/github/un-ts/lib-boilerplate.svg)](https://codecov.io/gh/un-ts/lib-boilerplate)
5-
[![type-coverage](https://img.shields.io/badge/dynamic/json.svg?label=type-coverage&prefix=%E2%89%A5&suffix=%&query=$.typeCoverage.atLeast&uri=https%3A%2F%2Fraw.githubusercontent.com%2Fun-ts%2Flib-boilerplate%2Fmain%2Fpackage.json)](https://github.com/plantain-00/type-coverage)
6-
[![CodeRabbit Pull Request Reviews](https://img.shields.io/coderabbit/prs/github/un-ts/lib-boilerplate)](https://coderabbit.ai)
7-
[![npm](https://img.shields.io/npm/v/lib-boilerplate.svg)](https://www.npmjs.com/package/lib-boilerplate)
8-
[![GitHub Release](https://img.shields.io/github/release/un-ts/lib-boilerplate)](https://github.com/un-ts/lib-boilerplate/releases)
3+
[![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/un-ts/eslint-import-context/ci.yml?branch=main)](https://github.com/un-ts/eslint-import-context/actions/workflows/ci.yml?query=branch%3Amain)
4+
[![Codecov](https://img.shields.io/codecov/c/github/un-ts/eslint-import-context.svg)](https://codecov.io/gh/un-ts/eslint-import-context)
5+
[![type-coverage](https://img.shields.io/badge/dynamic/json.svg?label=type-coverage&prefix=%E2%89%A5&suffix=%&query=$.typeCoverage.atLeast&uri=https%3A%2F%2Fraw.githubusercontent.com%2Fun-ts%2Feslint-import-context%2Fmain%2Fpackage.json)](https://github.com/plantain-00/type-coverage)
6+
[![CodeRabbit Pull Request Reviews](https://img.shields.io/coderabbit/prs/github/un-ts/eslint-import-context)](https://coderabbit.ai)
7+
[![npm](https://img.shields.io/npm/v/eslint-import-context.svg)](https://www.npmjs.com/package/eslint-import-context)
8+
[![GitHub Release](https://img.shields.io/github/release/un-ts/eslint-import-context)](https://github.com/un-ts/eslint-import-context/releases)
99

1010
[![Conventional Commits](https://img.shields.io/badge/conventional%20commits-1.0.0-yellow.svg)](https://conventionalcommits.org)
1111
[![Renovate enabled](https://img.shields.io/badge/renovate-enabled-brightgreen.svg)](https://renovatebot.com)
@@ -32,24 +32,26 @@ A simple library boilerplate.
3232

3333
```sh
3434
# pnpm
35-
pnpm add lib-boilerplate
35+
pnpm add eslint-import-context
3636

3737
# yarn
38-
yarn add lib-boilerplate
38+
yarn add eslint-import-context
3939

4040
# npm
41-
npm i lib-boilerplate
41+
npm i eslint-import-context
4242

4343
# bun
44-
bun add lib-boilerplate
44+
bun add eslint-import-context
4545
```
4646

4747
### API
4848

4949
```js
50-
import echo from 'lib-boilerplate'
50+
import { useRuleContext, getTsconfigWithContext } from 'eslint-import-context'
5151

52-
echo()
52+
const ruleContext = useRuleContext()
53+
54+
const tsconfig = getTsconfigWithContext(ruleContext)
5355
```
5456

5557
## Sponsors and Backers

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"name": "lib-boilerplate",
2+
"name": "eslint-import-context",
33
"version": "0.0.0",
44
"type": "module",
5-
"description": "A simple library boilerplate.",
6-
"repository": "git+https://github.com/un-ts/lib-boilerplate.git",
5+
"description": "Provide context info for eslint-plugin-import-x, so no extra arguments need to be added.",
6+
"repository": "git+https://github.com/un-ts/eslint-import-context.git",
77
"author": "JounQin <admin@1stg.me> (https://www.1stG.me)",
8-
"funding": "https://opencollective.com/unts",
8+
"funding": "https://opencollective.com/eslint-import-context",
99
"license": "MIT",
1010
"packageManager": "yarn@4.9.1",
1111
"engines": {
@@ -62,7 +62,6 @@
6262
"@eslint-react/eslint-plugin": "^1.49.0",
6363
"@mdx-js/rollup": "^3.1.0",
6464
"@shikijs/rehype": "^3.4.2",
65-
"@size-limit/preset-small-lib": "^11.2.0",
6665
"@types/mdx": "^2.0.13",
6766
"@types/node": "^22.15.21",
6867
"@types/react": "^19.1.5",
@@ -87,6 +86,7 @@
8786
"remark-gfm": "^4.0.1",
8887
"simple-git-hooks": "^2.13.0",
8988
"size-limit": "^11.2.0",
89+
"size-limit-preset-node-lib": "^0.4.0",
9090
"stylelint": "^16.19.1",
9191
"tsdown": "^0.12.2",
9292
"type-coverage": "^2.29.7",

src/index.ts

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1-
export default function echo() {
2-
return 'Hello World!'
1+
import type { ChildContext, RuleContext } from './types.js'
2+
3+
export type * from './types.js'
4+
export * from './utils.js'
5+
6+
let ruleContext: ChildContext | RuleContext | undefined
7+
8+
export const setRuleContext = <T = void>(
9+
nextRuleContext: ChildContext | RuleContext,
10+
callback: () => T,
11+
) => {
12+
const currentValue = ruleContext
13+
ruleContext = nextRuleContext
14+
const result = callback()
15+
ruleContext = currentValue
16+
return result
317
}
18+
19+
export const useRuleContext = () => ruleContext

0 commit comments

Comments
 (0)