Skip to content

Commit 344fd0d

Browse files
authored
Merge pull request #78 from Xvezda/feature/legacy-support
feature/legacy support
2 parents 37711d3 + 1e72143 commit 344fd0d

File tree

3 files changed

+34
-7
lines changed

3 files changed

+34
-7
lines changed

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,24 @@ export default tseslint.config(
155155
},
156156
);
157157
```
158+
159+
For legacy, `.eslintrc.json`
160+
161+
```json
162+
{
163+
"extends": [
164+
"eslint:recommended",
165+
"plugin:eslint-plugin-explicit-exceptions/recommended-type-checked-legacy"
166+
],
167+
"parser": "@typescript-eslint/parser",
168+
"plugins": ["@typescript-eslint"],
169+
"parserOptions": {
170+
"projectService": true
171+
},
172+
"root": true
173+
}
174+
```
175+
158176
Check out [`typescript-eslint`](https://typescript-eslint.io/getting-started/) for more information if you having an issue with configuring.
159177

160178
## License

examples/eslint.config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"use strict";
22

3-
const path = require("path");
43
const tseslint = require("typescript-eslint");
54
const eslintPlugin = require("../src/plugin");
65

src/plugin.js

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,26 @@ const plugin = {
1414
},
1515
};
1616

17+
const rules = /** @type {const} */({
18+
'explicit-exceptions/no-undocumented-throws': 'error',
19+
'explicit-exceptions/no-implicit-propagation': 'error',
20+
'explicit-exceptions/no-unhandled-rejection': 'error',
21+
'explicit-exceptions/check-throws-tag-type': 'error',
22+
});
23+
1724
const recommendedTypeChecked = /** @type {const} */({
1825
plugins: {
1926
'explicit-exceptions': plugin,
2027
},
21-
rules: {
22-
'explicit-exceptions/no-undocumented-throws': 'error',
23-
'explicit-exceptions/no-implicit-propagation': 'error',
24-
'explicit-exceptions/no-unhandled-rejection': 'error',
25-
'explicit-exceptions/check-throws-tag-type': 'error',
26-
}
28+
rules,
29+
});
30+
31+
// Legacy config for backwards compatibility
32+
Object.assign(plugin.configs, {
33+
'recommended-type-checked-legacy': {
34+
plugins: ['explicit-exceptions'],
35+
rules,
36+
},
2737
});
2838

2939
module.exports = plugin;

0 commit comments

Comments
 (0)