mdbetancourt / eslint-plugin-neverthrow

MIT License
44 stars 4 forks source link

rule.create is not a function #4

Closed lantw44 closed 3 years ago

lantw44 commented 3 years ago

I upgraded eslint-plugin-neverthrow to 1.1.0, but it still couldn't run.

$ npx eslint .

Oops! Something went wrong! :(

ESLint: 7.32.0

TypeError: Error while loading rule 'neverthrow/must-use-result': rule.create is not a function
Occurred while linting /path/to/project/src/client/2.2/emsp-commands.ts
    at createRuleListeners (/path/to/project/node_modules/eslint/lib/linter/linter.js:765:21)
    at /path/to/project/node_modules/eslint/lib/linter/linter.js:937:31
    at Array.forEach (<anonymous>)
    at runRules (/path/to/project/node_modules/eslint/lib/linter/linter.js:882:34)
    at Linter._verifyWithoutProcessors (/path/to/project/node_modules/eslint/lib/linter/linter.js:1181:31)
    at Linter._verifyWithConfigArray (/path/to/project/node_modules/eslint/lib/linter/linter.js:1280:21)
    at Linter.verify (/path/to/project/node_modules/eslint/lib/linter/linter.js:1235:25)
    at Linter.verifyAndFix (/path/to/project/node_modules/eslint/lib/linter/linter.js:1428:29)
    at verifyText (/path/to/project/node_modules/eslint/lib/cli-engine/cli-engine.js:240:48)
    at CLIEngine.executeOnFiles (/path/to/project/node_modules/eslint/lib/cli-engine/cli-engine.js:808:28)

Installed ESLint packages:

@typescript-eslint/eslint-plugin@4.33.0
@typescript-eslint/parser@4.33.0
eslint@7.32.0
eslint-config-airbnb-base@14.2.1
eslint-config-airbnb-typescript@13.0.1
eslint-import-resolver-typescript@2.5.0
eslint-plugin-functional@3.7.2
eslint-plugin-import@2.25.2
eslint-plugin-neverthrow@1.1.0
mdbetancourt commented 3 years ago

fixed, the template uses async imports and eslint doesn't support it, i updated the readme with the required configuration too

module.exports = {
    plugins: ["neverthrow"],
    rules: {
        "neverthrow/must-use-result": "error"
    },
    parser: '@typescript-eslint/parser',
    parserOptions: {
        project: ["./tsconfig.json"],
        tsconfigRootDir: __dirname
    }
}