Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

feat: add declaration file #280

Merged
merged 3 commits into from
Mar 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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