Skip to content

Commit

Permalink
Merge pull request #260 from AndreaPontrandolfo/AndreaPontrandolfo/is…
Browse files Browse the repository at this point in the history
…sue233

AndreaPontrandolfo/issue233
  • Loading branch information
AndreaPontrandolfo authored Sep 22, 2024
2 parents 58e200e + 8bbde20 commit 41cf80a
Show file tree
Hide file tree
Showing 18 changed files with 50 additions and 185 deletions.
9 changes: 9 additions & 0 deletions .changeset/few-news-relax.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
'eslint-config-sheriff': major
'@sherifforg/create-config': patch
'@sherifforg/cli': patch
'docs-website': patch
---

feat(types): now Sheriff types are exposed through the eslint-config-sheriff package instead of @sherifforg/types.
Closes #233
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ This repository is a monorepo that hosts the sourcecode of the following project
| [`eslint-config-sheriff`](https://www.npmjs.com/package/eslint-config-sheriff) | [eslint-config-sheriff](https://github.com/AndreaPontrandolfo/sheriff/tree/master/packages/eslint-config-sheriff) | A comprehensive and opinionated Typescript-first ESLint configuration | [![npm](https://img.shields.io/npm/v/eslint-config-sheriff.svg)](https://www.npmjs.com/package/eslint-config-sheriff) |
| [`@sherifforg/create-config`](https://www.npmjs.com/package/@sherifforg/create-config) | [sheriff-create-config](https://github.com/AndreaPontrandolfo/sheriff/tree/master/packages/sheriff-create-config) | Package used to create Sheriff-based ESLint configs | [![npm](https://img.shields.io/npm/v/@sherifforg/create-config.svg)](https://www.npmjs.com/package/@sherifforg/create-config) |
| [`@sherifforg/cli`](https://www.npmjs.com/package/@sherifforg/cli) | [sheriff-cli](https://github.com/AndreaPontrandolfo/sheriff/tree/master/packages/sheriff-cli) | The Sheriff CLI. Used to manage Sheriff-based ESLint configs | [![npm](https://img.shields.io/npm/v/@sherifforg/cli.svg)](https://www.npmjs.com/package/@sherifforg/cli) |
| [`@sherifforg/types`](https://www.npmjs.com/package/@sherifforg/types) | [sheriff-types](https://github.com/AndreaPontrandolfo/sheriff/tree/master/packages/sheriff-types) | Sheriff types package | [![npm](https://img.shields.io/npm/v/@sherifforg/types.svg)](https://www.npmjs.com/package/@sherifforg/types) |

## 🚀 Getting Started

Expand Down
30 changes: 10 additions & 20 deletions apps/docs-website/docs/configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,8 @@ export default defineFlatConfig([...sheriff(sheriffOptions)]);
<TabItem value="TS" label="TS">

```ts title="eslint.config.ts"
import sheriff from "eslint-config-sheriff";
import sheriff, { type SheriffSettings } from "eslint-config-sheriff";
import { defineFlatConfig } from "eslint-define-config";
import type { SheriffSettings } from "@sherifforg/types";

// highlight-start
// Sheriff configuration object
Expand Down Expand Up @@ -113,9 +112,8 @@ export default defineFlatConfig([
<TabItem value="TS" label="TS">

```ts title="eslint.config.ts"
import sheriff from "eslint-config-sheriff";
import sheriff, { type SheriffSettings } from "eslint-config-sheriff";
import { defineFlatConfig } from "eslint-define-config";
import type { SheriffSettings } from "@sherifforg/types";

const sheriffOptions: SheriffSettings = {
react: false,
Expand Down Expand Up @@ -177,9 +175,8 @@ export default defineFlatConfig([
<TabItem value="TS" label="TS">

```ts title="eslint.config.ts"
import sheriff from "eslint-config-sheriff";
import sheriff, { type SheriffSettings } from "eslint-config-sheriff";
import { defineFlatConfig } from "eslint-define-config";
import type { SheriffSettings } from "@sherifforg/types";

const sheriffOptions: SheriffSettings = {
react: false,
Expand Down Expand Up @@ -269,9 +266,8 @@ export default defineFlatConfig([...sheriff(sheriffOptions)]);
<TabItem value="TS" label="TS">

```ts title="eslint.config.ts"
import sheriff from "eslint-config-sheriff";
import sheriff, { type SheriffSettings } from "eslint-config-sheriff";
import { defineFlatConfig } from "eslint-define-config";
import type { SheriffSettings } from "@sherifforg/types";

const sheriffOptions: SheriffSettings = {
react: false,
Expand Down Expand Up @@ -331,9 +327,8 @@ export default defineFlatConfig([...sheriff(sheriffOptions)]);
<TabItem value="TS" label="TS">

```ts title="eslint.config.ts"
import sheriff from "eslint-config-sheriff";
import sheriff, { type SheriffSettings } from "eslint-config-sheriff";
import { defineFlatConfig } from "eslint-define-config";
import type { SheriffSettings } from "@sherifforg/types";

const sheriffOptions: SheriffSettings = {
react: false,
Expand Down Expand Up @@ -407,9 +402,8 @@ export default defineFlatConfig([...sheriff(sheriffOptions)]);
<TabItem value="TS" label="TS">

```ts title="eslint.config.ts"
import sheriff from "eslint-config-sheriff";
import sheriff, { type SheriffSettings } from "eslint-config-sheriff";
import { defineFlatConfig } from "eslint-define-config";
import type { SheriffSettings } from "@sherifforg/types";

const sheriffOptions: SheriffSettings = {
react: false,
Expand Down Expand Up @@ -480,9 +474,8 @@ export default defineFlatConfig([...sheriff(sheriffOptions)]);
<TabItem value="TS" label="TS">

```ts title="eslint.config.ts"
import sheriff from "eslint-config-sheriff";
import sheriff, { type SheriffSettings } from "eslint-config-sheriff";
import { defineFlatConfig } from "eslint-define-config";
import type { SheriffSettings } from "@sherifforg/types";

const sheriffOptions: SheriffSettings = {
react: false,
Expand Down Expand Up @@ -559,9 +552,8 @@ export default defineFlatConfig([
<TabItem value="TS" label="TS">

```ts title="eslint.config.ts"
import sheriff from "eslint-config-sheriff";
import sheriff, { type SheriffSettings } from "eslint-config-sheriff";
import { defineFlatConfig } from "eslint-define-config";
import type { SheriffSettings } from "@sherifforg/types";

const sheriffOptions: SheriffSettings = {
react: false,
Expand Down Expand Up @@ -637,9 +629,8 @@ export default defineFlatConfig([
<TabItem value="TS" label="TS">

```ts title="eslint.config.ts"
import sheriff, { baseNoRestrictedSyntaxRules } from "eslint-config-sheriff";
import sheriff, { baseNoRestrictedSyntaxRules, type SheriffSettings } from "eslint-config-sheriff";
import { defineFlatConfig } from "eslint-define-config";
import type { SheriffSettings } from "@sherifforg/types";

const sheriffOptions: SheriffSettings = {
react: false,
Expand Down Expand Up @@ -716,9 +707,8 @@ export default defineFlatConfig([
<TabItem value="TS" label="TS">

```ts title="eslint.config.ts"
import sheriff from "eslint-config-sheriff";
import sheriff, { type SheriffSettings } from "eslint-config-sheriff";
import { defineFlatConfig } from "eslint-define-config";
import type { SheriffSettings } from "@sherifforg/types";

const sheriffOptions: SheriffSettings = {
react: false,
Expand Down
3 changes: 1 addition & 2 deletions apps/docs-website/docs/migration-guide.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,8 @@ export default defineFlatConfig([...sheriff(sheriffOptions)]);
<TabItem value="TS" label="TS">

```ts title="eslint.config.ts"
import sheriff from "eslint-config-sheriff";
import sheriff, { type SheriffSettings } from "eslint-config-sheriff";
import { defineFlatConfig } from "eslint-define-config";
import type { SheriffSettings } from "@sherifforg/types";

const sheriffOptions: SheriffSettings = {
// highlight-next-line
Expand Down
3 changes: 1 addition & 2 deletions apps/docs-website/docs/performance-considerations.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,8 @@ export default defineFlatConfig([
<TabItem value="TS" label="TS">

```ts title="eslint.config.ts"
import sheriff from "eslint-config-sheriff";
import sheriff, { type SheriffSettings } from "eslint-config-sheriff";
import { defineFlatConfig } from "eslint-define-config";
import type { SheriffSettings } from "@sherifforg/types";

const sheriffOptions: SheriffSettings = {
react: false,
Expand Down
5 changes: 2 additions & 3 deletions apps/docs-website/docs/setup/manual-setup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,14 @@ Follow these steps:
-
```bash npm2yarn
npm install -D eslint-ts-patch eslint@npm:eslint-ts-patch @sherifforg/types
npm install -D eslint-ts-patch eslint@npm:eslint-ts-patch
```
- change the extension of `eslint.config.mjs` from `.mjs` to `.ts`
- define the types of the `sheriffOptions` object:
```ts title="eslint.config.ts"
import sheriff from "eslint-config-sheriff";
import sheriff, { SheriffSettings } from "eslint-config-sheriff";
import { defineFlatConfig } from "eslint-define-config";
import type { SheriffSettings } from "@sherifforg/types";
const sheriffOptions: SheriffSettings = {
react: false,
Expand Down
5 changes: 2 additions & 3 deletions packages/eslint-config-sheriff/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"exports": {
"./package.json": "./package.json",
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js"
}
},
Expand Down Expand Up @@ -49,8 +50,7 @@
"build-watch": "tsup",
"typecheck": "tsc --noEmit",
"publint": "publint",
"typesync": "typesync --dry=fail",
"are-the-types-wrong": "attw $(pnpm pack) --ignore-rules cjs-resolves-to-esm no-resolution && rm eslint-config-sheriff-*.tgz"
"typesync": "typesync --dry=fail"
},
"dependencies": {
"@eslint-react/eslint-plugin": "^1.10.1",
Expand Down Expand Up @@ -94,7 +94,6 @@
},
"license": "MIT",
"devDependencies": {
"@arethetypeswrong/cli": "^0.15.4",
"@sherifforg/constants": "workspace:*",
"@sherifforg/types": "workspace:*",
"@types/confusing-browser-globals": "^1.0.3",
Expand Down
3 changes: 3 additions & 0 deletions packages/eslint-config-sheriff/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,7 @@ export {
supportedFileTypes,
testsFilePatterns,
};

export type * from '@sherifforg/types';

export default getExportableConfig;
3 changes: 1 addition & 2 deletions packages/sheriff-cli/src/utils/getEslintConfigRawText.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@ export const getEslintConfigRawText = async (
}

const eslintConfigRawText = {
ts: `import sheriff from 'eslint-config-sheriff';
ts: `import sheriff, { type SheriffSettings } from 'eslint-config-sheriff';
import { defineFlatConfig } from 'eslint-define-config';
import type { SheriffSettings } from '@sherifforg/types';
const sheriffOptions: SheriffSettings = ${JSON.stringify(
sheriffConfig,
Expand Down
2 changes: 0 additions & 2 deletions packages/sheriff-cli/src/utils/getRequiredPackages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ export const getRequiredPackages = (
if (isEslintTsPatchRequired) {
requiredPackages.push(`eslint-ts-patch`, `eslint@npm:eslint-ts-patch`);
consola.start("Installing 'eslint-ts-patch'...");
requiredPackages.push('@sherifforg/types');
consola.start("Installing '@sherifforg/types'...");
}

return requiredPackages;
Expand Down
17 changes: 14 additions & 3 deletions packages/sheriff-constants/package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
{
"name": "@sherifforg/constants",
"description": "Sheriff constants.",
"version": "0.1.1",
"private": true,
"type": "module",
"exports": {
".": "./src/index.ts"
},
"files": [
"src",
"CHANGELOG.md"
"src"
],
"scripts": {
"clean": "rm -rf .turbo"
Expand All @@ -18,5 +16,18 @@
"@sherifforg/types": "workspace:*",
"tsconfig": "workspace:*",
"typescript": "^5.5.3"
},
"engines": {
"node": ">=20.10.0"
},
"repository": {
"type": "git",
"url": "git+https://github.com/AndreaPontrandolfo/sheriff.git",
"directory": "packages/sheriff-constants"
},
"author": {
"name": "Andrea Pontrandolfo",
"email": "[email protected]",
"url": "https://github.com/AndreaPontrandolfo"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@ export const getEslintConfigRawText = async (
}

const eslintConfigRawText = {
ts: `import sheriff from 'eslint-config-sheriff';
ts: `import sheriff, { type SheriffSettings } from 'eslint-config-sheriff';
import { defineFlatConfig } from 'eslint-define-config';
import type { SheriffSettings } from '@sherifforg/types';
const sheriffOptions: SheriffSettings = ${JSON.stringify(
sheriffConfig,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ export const getRequiredPackages = (
if (isEslintTsPatchRequired) {
requiredPackages.push(`eslint-ts-patch`, `eslint@npm:eslint-ts-patch`);
consola.start("Installing 'eslint-ts-patch'...");
requiredPackages.push('@sherifforg/types');
consola.start("Installing '@sherifforg/types'...");
}

return requiredPackages;
Expand Down
28 changes: 5 additions & 23 deletions packages/sheriff-types/package.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,20 @@
{
"name": "@sherifforg/types",
"description": "Sheriff types.",
"version": "4.1.1",
"license": "MIT",
"type": "module",
"files": [
"dist"
],
"exports": {
".": {
"import": "./dist/index.js"
}
".": "./src/index.ts"
},
"files": [
"src"
],
"scripts": {
"clean": "rm -rf .turbo dist",
"typecheck": "tsc --noEmit",
"publint": "publint",
"build": "tsup"
"typecheck": "tsc --noEmit"
},
"devDependencies": {
"@types/node": "^22.5.1",
"publint": "^0.2.10",
"tsconfig": "workspace:*",
"tsup": "^8.2.4",
"typescript": "^5.5.3"
},
"repository": {
Expand All @@ -35,16 +27,6 @@
"email": "[email protected]",
"url": "https://github.com/AndreaPontrandolfo"
},
"publishConfig": {
"access": "public"
},
"bug": "https://github.com/AndreaPontrandolfo/sheriff/labels/bug",
"keywords": [
"javascript",
"eslint",
"typescript",
"types"
],
"engines": {
"node": ">=20.10.0"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/sheriff-types/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"include": ["src"],
"exclude": ["dist", "build", "node_modules"],
"exclude": ["node_modules"],
"extends": "tsconfig/base.json",
"compilerOptions": {
"module": "ESNext",
Expand Down
8 changes: 0 additions & 8 deletions packages/sheriff-types/tsup.config.json

This file was deleted.

Loading

0 comments on commit 41cf80a

Please sign in to comment.