Skip to content

Commit

Permalink
fix: update readme documentation for flat configurations
Browse files Browse the repository at this point in the history
  • Loading branch information
mscharley committed Oct 7, 2024
1 parent b54e1e9 commit 7d6a205
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 28 deletions.
5 changes: 5 additions & 0 deletions .changeset/odd-ads-fly.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@mscharley/eslint-config': patch
---

Fix readme for flat configurations
37 changes: 9 additions & 28 deletions presets/eslint/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ $ npm install --save-dev @mscharley/eslint-config
## Usage

```js
// .eslintrc.js
module.exports = {
root: true,
extends: [
'@mscharley', // Baseline rules for any TS or JS project.
'@mscharley/eslint-config/node', // For projects running on NodeJS.
// '@mscharley/eslint-config/react', // For projects running React.
],
};
// eslint.config.js
import { configs, withStyles } from "@mscharley/eslint-config";

export const [
...configs.recommended,
...configs.node, // For projects running on NodeJS
// ...configs.react, // For projects running React
...withStyles(), // Include formatting rules
];
```

### Notes on Prettier
Expand All @@ -45,25 +45,6 @@ If using Prettier to format files other than TypeScript and JavaScript files the
**/*.js
```

## Extras

### Deprecation warnings for JavaScript files

As a general rule we can't enable the `deprecation/deprecation` rule for JavaScript files because this rule requires TypeScript type information to work. If you have a mixed TypeScript/JavaScript project then you can enable it for the JavaScript files inside your TypeScript project using the following override:

```js
// .eslintrc.js
module.exports = {
overrides: [
{
// This must be a valid path inside your TypeScript source folders.
files: ["src/**/*.{js,jsx}"],
rules: { "deprecation/deprecation": "warn" },
},
],
};
```

[gh-contrib]: https://github.com/mscharley/node-presets/graphs/contributors
[gh-issues]: https://github.com/mscharley/node-presets/issues
[license]: https://github.com/mscharley/node-presets/blob/main/LICENSE

0 comments on commit 7d6a205

Please sign in to comment.