Skip to content

Commit

Permalink
Include a missing file and update the docs for @rushstack/eslint-patch.
Browse files Browse the repository at this point in the history
  • Loading branch information
iclanton committed Sep 26, 2023
1 parent 3eaac21 commit dd5dd10
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
10 changes: 10 additions & 0 deletions eslint/eslint-config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ for TypeScript. Add your profile string in the `extends` field, as shown below:
```ts
// This is a workaround for https://github.com/eslint/eslint/issues/3458
require('@rushstack/eslint-config/patch/modern-module-resolution');
// This is a workaround for https://github.com/microsoft/rushstack/issues/3021
require('@rushstack/eslint-config/patch/custom-config-package-names');

module.exports = {
extends: [ "@rushstack/eslint-config/profile/node" ], // <---- put your profile string here
Expand Down Expand Up @@ -173,6 +175,8 @@ Add the mixin to your `"extends"` field like this:
```ts
// This is a workaround for https://github.com/eslint/eslint/issues/3458
require('@rushstack/eslint-config/patch/modern-module-resolution');
// This is a workaround for https://github.com/microsoft/rushstack/issues/3021
require('@rushstack/eslint-config/patch/custom-config-package-names');

module.exports = {
extends: [
Expand All @@ -196,6 +200,8 @@ To use packlets, add the mixin to your `"extends"` field like this:
```ts
// This is a workaround for https://github.com/eslint/eslint/issues/3458
require('@rushstack/eslint-config/patch/modern-module-resolution');
// This is a workaround for https://github.com/microsoft/rushstack/issues/3021
require('@rushstack/eslint-config/patch/custom-config-package-names');

module.exports = {
extends: [
Expand All @@ -220,6 +226,8 @@ Add the mixin to your `"extends"` field like this:
```ts
// This is a workaround for https://github.com/eslint/eslint/issues/3458
require('@rushstack/eslint-config/patch/modern-module-resolution');
// This is a workaround for https://github.com/microsoft/rushstack/issues/3021
require('@rushstack/eslint-config/patch/custom-config-package-names');

module.exports = {
extends: [
Expand Down Expand Up @@ -248,6 +256,8 @@ Add the mixin to your `"extends"` field like this:
```ts
// This is a workaround for https://github.com/eslint/eslint/issues/3458
require('@rushstack/eslint-config/patch/modern-module-resolution');
// This is a workaround for https://github.com/microsoft/rushstack/issues/3021
require('@rushstack/eslint-config/patch/custom-config-package-names');

module.exports = {
extends: [
Expand Down
20 changes: 19 additions & 1 deletion eslint/eslint-patch/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,25 @@ This patch works by modifying the ESLint engine so that its module resolver will
the referencing config file, rather than the project folder. The patch is compatible with ESLint 6, 7, and 8.
It also works with any editor extensions that load ESLint as a library.

For an even leaner setup, `@your-company/eslint-config` can provide the patch as its own dependency. See
There is a second patch in this package that removes the restriction on eslint configuration package names.
Similarly to the first, this patch is applied by adding a `require()` call to the top of the **.eslintrc.js**,
for example:

**.eslintrc.js**
```ts
require("@rushstack/eslint-patch/modern-module-resolution");
require("@rushstack/eslint-patch/custom-config-package-names"); // <-- Add this line

// Add your "extends" boilerplate here, for example:
module.exports = {
extends: [
'@your-company/build-rig/profile/default/includes/eslint/node' // Notice the package name does not start with "eslint-config-"
],
parserOptions: { tsconfigRootDir: __dirname }
};
```

For an even leaner setup, `@your-company/eslint-config` can provide the patches as its own dependency. See
[@rushstack/eslint-config](https://www.npmjs.com/package/@rushstack/eslint-config) for a real world example
and recommended approach.

Expand Down
1 change: 1 addition & 0 deletions eslint/eslint-patch/custom-config-package-names.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require('./lib/custom-config-package-names');

0 comments on commit dd5dd10

Please sign in to comment.