Skip to content

Commit

Permalink
🐛♻️ use rushstack's eslint-patch to avoid eslint dep hoist
Browse files Browse the repository at this point in the history
This also refactors all configs that use plugins to be written in TS instead of YAML
  • Loading branch information
dudeofawesome committed May 8, 2024
1 parent 874e9b5 commit 9a2343f
Show file tree
Hide file tree
Showing 77 changed files with 1,178 additions and 1,122 deletions.
7 changes: 0 additions & 7 deletions code-style.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,6 @@
{ "path": "packages/eslint-config-node" },
{ "path": "packages/eslint-config-react" },
{ "path": "packages/eslint-config-typescript" },
{ "path": "packages/eslint-npm-hoist-packages" },
{ "path": "packages/eslint-npm-hoist-packages-esmodule" },
{ "path": "packages/eslint-npm-hoist-packages-jest" },
{ "path": "packages/eslint-npm-hoist-packages-nextjs" },
{ "path": "packages/eslint-npm-hoist-packages-node" },
{ "path": "packages/eslint-npm-hoist-packages-react" },
{ "path": "packages/eslint-npm-hoist-packages-typescript" },
{ "path": "packages/eslint-plugin-nest" },
{ "path": "packages/jest-configs" },
{ "path": "packages/rubocop-configs" },
Expand Down
121 changes: 24 additions & 97 deletions package-lock.json

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

12 changes: 0 additions & 12 deletions packages/eslint-config-esmodule/base.yaml

This file was deleted.

16 changes: 10 additions & 6 deletions packages/eslint-config-esmodule/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,25 @@
},
"license": "MIT",
"author": "Louis Orleans <louis@orleans.io>",
"type": "commonjs",
"exports": {
".": "./base.yaml",
"./base": "./base.yaml",
"./*.yaml": "./*.yaml"
".": "./dist/base.js",
"./*": "./dist/*.js"
},
"main": "base.yaml",
"main": "dist/base.js",
"files": [
"/base.yaml"
"/dist"
],
"scripts": {
"build": "concurrently --raw --group 'npm:build:*'",
"build:js": "esbuild --tsconfig=tsconfig.build.json $(glob 'src/**/*.?(c|m)[jt]s' --ignore '**/*.spec.*') --outdir=dist/ --sourcemap=inline --platform=node --target=node18 --format=cjs",
"build:types": "tsc --project tsconfig.build.json --emitDeclarationOnly",
"prepublishOnly": "npm run build",
"test": "node $NODE_OPTS --require tsm --test $(glob --ignore '**/node_modules/**' --ignore '**/dist/**' '**/*[.-_]test.?(c|m)[jt]s' '**/test?(-*).?(c|m)[jt]s' '**/test/**/*.?(c|m)[jt]s')",
"test:debug": "NODE_OPTS='--inspect-brk' npm run test"
},
"dependencies": {
"@rushstack/eslint-patch": "^1.10.2",
"eslint-plugin-import": "^2.28.1"
},
"devDependencies": {
Expand All @@ -39,7 +44,6 @@
"tsm": "^2.3.0"
},
"peerDependencies": {
"@code-style/eslint-npm-hoist-packages-esmodule": "2.0.0-30",
"eslint": "^8.49.0"
},
"engines": {
Expand Down
21 changes: 21 additions & 0 deletions packages/eslint-config-esmodule/src/base.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import '@rushstack/eslint-patch/modern-module-resolution';
import type { ESLint } from 'eslint';

const config: ESLint.ConfigData = {
plugins: ['eslint-plugin-import'],

parserOptions: {
sourceType: 'module',
},

rules: {
/** Disallow commonjs modules. */
'import/no-commonjs': 'error',

// TODO: this could turn off other `no-restricted-syntax1 rules unintentionally
/** Turn off the `import` ban from `@code-style/eslint-config/rule-sets/imports.yaml` */
'no-restricted-syntax': 'off',
},
};

export = config;
8 changes: 8 additions & 0 deletions packages/eslint-config-esmodule/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": ["./tsconfig.json"],
"compilerOptions": {
"baseUrl": "./"
},
"include": ["src/"],
"exclude": ["**/*.spec.ts"]
}
Loading

0 comments on commit 9a2343f

Please sign in to comment.