Skip to content

Commit

Permalink
Feat/support eslint 9 (#400)
Browse files Browse the repository at this point in the history
* feat(update): fight with tsc

* feat(sugg): update fixes

* chore(cleanup): cleaned up rules
  • Loading branch information
veritem committed Mar 25, 2024
1 parent bbe0130 commit 4079285
Show file tree
Hide file tree
Showing 15 changed files with 36 additions and 21 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ If you're using this feature, you should also enabled `typecheck` in the setting
🌐 Set in the `all` configuration.\
✅ Set in the `recommended` configuration.\
🔧 Automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/user-guide/command-line-interface#--fix).\
💡 Manually fixable by [editor suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).\
💡 Manually fixable by [editor suggestions](https://eslint.org/docs/latest/use/core-concepts#rule-suggestions).\
❌ Deprecated.

| Name                                                | Description | 💼 | ⚠️ | 🔧 | 💡 ||
Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-done-callback.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

⚠️ This rule _warns_ in the 🌐 `all` config.

💡 This rule is manually fixable by [editor suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).
💡 This rule is manually fixable by [editor suggestions](https://eslint.org/docs/latest/use/core-concepts#rule-suggestions).

<!-- end auto-generated rule header -->

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/prefer-equality-matcher.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

⚠️ This rule _warns_ in the 🌐 `all` config.

💡 This rule is manually fixable by [editor suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).
💡 This rule is manually fixable by [editor suggestions](https://eslint.org/docs/latest/use/core-concepts#rule-suggestions).

<!-- end auto-generated rule header -->

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/prefer-expect-assertions.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

⚠️ This rule _warns_ in the 🌐 `all` config.

💡 This rule is manually fixable by [editor suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).
💡 This rule is manually fixable by [editor suggestions](https://eslint.org/docs/latest/use/core-concepts#rule-suggestions).

<!-- end auto-generated rule header -->

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/prefer-strict-equal.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

⚠️ This rule _warns_ in the 🌐 `all` config.

💡 This rule is manually fixable by [editor suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).
💡 This rule is manually fixable by [editor suggestions](https://eslint.org/docs/latest/use/core-concepts#rule-suggestions).

<!-- end auto-generated rule header -->

Expand Down
4 changes: 3 additions & 1 deletion src/rules/consistent-test-it.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export default createEslintRule<
fixable: 'code',
docs: {
description: 'Prefer test or it but not both',
recommended: 'warn'
recommended: 'strict'
},
messages: {
consistentMethod:
Expand All @@ -69,9 +69,11 @@ export default createEslintRule<
type: 'object',
properties: {
fn: {
type: 'string',
enum: [TestCaseName.test, TestCaseName.it]
},
withinDescribe: {
type: 'string',
enum: [TestCaseName.test, TestCaseName.it]
}
},
Expand Down
2 changes: 1 addition & 1 deletion src/rules/max-expects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default createEslintRule<Options, MESSAGE_ID>({
meta: {
docs: {
requiresTypeChecking: false,
recommended: 'error',
recommended: 'strict',
description: 'Enforce a maximum number of expect per test'
},
messages: {
Expand Down
2 changes: 1 addition & 1 deletion src/rules/max-nested-describe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default createEslintRule<Options, MESSAGE_ID>({
docs: {
description:
'Nested describe block should be less than set max value or default value',
recommended: 'error'
recommended: 'strict'
},
schema: [
{
Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-disabled-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default createEslintRule<Options, MESSAGE_ID>({
type: 'suggestion',
docs: {
description: 'Disallow disabled tests',
recommended: false
recommended: 'strict'
},
messages: {
missingFunction: 'Test is missing function argument',
Expand Down
4 changes: 2 additions & 2 deletions src/rules/no-done-callback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ export default createEslintRule<Options, MessageIds>({
type: 'suggestion',
docs: {
description: 'Disallow using a callback in asynchronous tests and hooks',
recommended: 'error'
recommended: 'strict'
},
deprecated: true,
deprecated: true,
schema: [],
messages: {
noDoneCallback: 'Return a promise instead of relying on callback parameter',
Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-restricted-vi-methods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default createEslintRule<Options, MESSAGE_ID>({
type: 'suggestion',
docs: {
description: 'Disallow specific `vi.` methods',
recommended: false
recommended: 'strict'
},
schema: [{
type: 'object',
Expand Down
2 changes: 1 addition & 1 deletion src/rules/prefer-strict-equal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default createEslintRule<Options, MESSAGE_IDS>({
type: 'suggestion',
docs: {
description: 'Prefer strict equal over equal',
recommended: 'warn'
recommended: 'strict'
},
messages: {
useToStrictEqual: 'Use `toStrictEqual()` instead',
Expand Down
2 changes: 1 addition & 1 deletion src/rules/valid-expect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export default createEslintRule<[
meta: {
docs: {
description: 'Enforce valid `expect()` usage',
recommended: 'error'
recommended: 'strict'
},
messages: {
tooManyArgs: 'Expect takes most {{ amount}} argument{{s}}',
Expand Down
14 changes: 7 additions & 7 deletions tests/consistent-test-it.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@ ruleTester.run(RULE_NAME, rule, {
valid: [
{
code: `it("shows error", () => {
expect(true).toBe(false);
});`,
expect(true).toBe(false);
});`,
options: [{ fn: TestCaseName.it }]
},
{
code: `it("foo", function () {
expect(true).toBe(false);
})`,
expect(true).toBe(false);
})`,
options: [{ fn: TestCaseName.it }]
},
{
code: ` it('foo', () => {
expect(true).toBe(false);
});
function myTest() { if ('bar') {} }`,
expect(true).toBe(false);
});
function myTest() { if ('bar') {} }`,
options: [{ fn: TestCaseName.it }]
}
],
Expand Down
13 changes: 13 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"compilerOptions": {
"target": "es2016",
"module": "Node16",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipDefaultLibCheck": true,
"skipLibCheck": true,
},
"include": [ "**/*.ts" ]
}

0 comments on commit 4079285

Please sign in to comment.