Skip to content

Commit

Permalink
Convert tests to use RuleTester instead of --report-unused-disable-di…
Browse files Browse the repository at this point in the history
…rectives (#31)

**Public-Facing Changes**
- `no-boolean-parameters` correctly reports the function name in variable assignments like `const x = (a: boolean) => {}`
- `no-meaningless-void-operator` no longer reports errors on `never` values by default; added `checkNever` option to enable (imported these changes from typescript-eslint/typescript-eslint#3641)

**Description**
The `RuleTester` provides the ability to assert on specific error messages and fixes that rules produce. It's also more in line with how the upstream projects (eslint and typescript-eslint) test their rules, which will smooth the process if we decide to upstream these rules.

The tests for (and changes to) no-meaningless-void-operator are changes I made based on feedback on my typescript-eslint PR: typescript-eslint/typescript-eslint#3641

Imported jest.config.js from template-typescript.
  • Loading branch information
jtbandes committed Aug 30, 2021
1 parent 2cb07e2 commit 6d943de
Show file tree
Hide file tree
Showing 14 changed files with 10,703 additions and 1,596 deletions.
8 changes: 8 additions & 0 deletions .eslintrc.js
Expand Up @@ -4,4 +4,12 @@ module.exports = {
parserOptions: {
project: "tsconfig.json",
},

overrides: [
{
files: ["*.ts", "*.tsx"],
extends: ["plugin:@foxglove/typescript"],
parserOptions: { project: "tsconfig.json" },
},
],
};
File renamed without changes.
4 changes: 4 additions & 0 deletions jest.config.js
@@ -0,0 +1,4 @@
module.exports = {
preset: "ts-jest",
testMatch: ["<rootDir>/**/*.test.ts"],
};

0 comments on commit 6d943de

Please sign in to comment.