Skip to content

Commit

Permalink
feat: add declaration file (#280)
Browse files Browse the repository at this point in the history
Co-authored-by: JounQin <[email protected]>
  • Loading branch information
zanminkian and JounQin authored Mar 7, 2025
1 parent 9297b8e commit cba5737
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/moody-teachers-build.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"eslint-config-prettier": patch
---

feat: add declaration file
6 changes: 6 additions & 0 deletions .eslintrc.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,12 @@ module.exports = {
files: ["test-lint/@stylistic__ts.ts"],
extends: ["plugin:@stylistic/ts/all-extends"],
},
{
files: ["**/*.d.ts"],
rules: {
strict: "off",
},
},
],
settings: {
react: {
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ jobs:
commit: "chore: release eslint-config-prettier"
title: "chore: release eslint-config-prettier"
publish: npm run release
version: npm run version
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
6 changes: 6 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,10 @@ module.exports = [
},
})
),
{
files: ["**/*.d.ts"],
rules: {
strict: "off",
},
},
];
7 changes: 7 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
type Config = {
rules: Record<string, 0 | "off">;
};

declare const config: Config;

export = config;
4 changes: 2 additions & 2 deletions package-lock.json

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

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"repository": "prettier/eslint-config-prettier",
"bin": "build/bin/cli.js",
"main": "build/index.js",
"types": "build/index.d.ts",
"type": "commonjs",
"files": [
"build"
Expand Down Expand Up @@ -36,7 +37,8 @@
"test:with-env": "npm run test:eslint && npm run test:jest && npm run test:cli-sanity && npm run test:cli-sanity-warning",
"test": "npm run test:prettier && ESLINT_CONFIG_PRETTIER_NO_DEPRECATED=true npm run test:with-env && ESLINT_USE_FLAT_CONFIG=false npm run test:with-env && npm run build",
"build": "node scripts/build.js",
"release": "npm run build && clean-pkg-json && changeset publish"
"release": "npm run build && clean-pkg-json && changeset publish",
"version": "changeset version && npm i"
},
"devDependencies": {
"@babel/eslint-parser": "7.23.3",
Expand Down
1 change: 1 addition & 0 deletions scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const BUILD = path.join(DIR, "build");

const FILES_TO_COPY = [
{ src: "index.js" },
{ src: "index.d.ts" },
{ src: "prettier.js" },
...fs
.readdirSync(path.join(DIR, "bin"))
Expand Down

0 comments on commit cba5737

Please sign in to comment.