phenomnomnominal / betterer

betterer makes it easier to make incremental improvements to your codebase
MIT License
569 stars 38 forks source link

VSCode extension feels slow, especially compared to eslint #1171

Open tarngerine opened 10 months ago

tarngerine commented 10 months ago

Describe the bug I only have a single eslint rule, which runs very quickly in eslint. Porting it over to betterer, it runs way slower in VSCode.

Also, it only runs on save — eslint runs as you type

To Reproduce

betterer.ts:

import { eslint } from "@betterer/eslint";

export default {
  "require JSDoc for exports": () =>
    eslint({
      "jsdoc/require-jsdoc": [
        "warn",
        {
          publicOnly: true,
          require: {
            ArrowFunctionExpression: true,
            ClassDeclaration: true,
            ClassExpression: true,
            FunctionDeclaration: true,
            FunctionExpression: true,
            MethodDefinition: true,
          },
          contexts: [
            'CallExpression[callee.name="observer"]', // observer(SomeComponent)
            'CallExpression[callee.name="suspenseObserver"]', // suspenseObserver(SomeComponent)
            'MemberExpression[object.name="React"][property.name="forwardRef"]', // React.forwardRef
            'MemberExpression[object.name="React"][property.name="createContext"]', // React.createContext
            'Identifier[name="styled"]', // styled.div, styled()
            "TSInterfaceDeclaration", // interface
            "TSTypeAliasDeclaration", // type
            "TSEnumDeclaration", // enum
          ],
          enableFixer: false,
        },
      ],
    }).include("./client/src/**/*.{ts,tsx}"),
};

Expected behavior To be as fast as eslint:

https://github.com/phenomnomnominal/betterer/assets/1629901/07312e5c-658e-43b6-bca5-0c13f41aacce

Actual behavior Takes a split second longer, and also requires saving

https://github.com/phenomnomnominal/betterer/assets/1629901/d104401c-13bc-44d3-9a5e-55ae034a8b51

Versions (please complete the following information):