question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error when using with eslint-plugin-rxjs

See original GitHub issue

Describe the bug We have https://www.npmjs.com/package/eslint-plugin-rxjs rules, and with configuration from the docs, we get following error:

Error: Error while loading rule 'rxjs/no-async-subscribe': You have used a rule which requires parserServices to be generated. You must therefore provide a value for the "parserOptions.project" property for @typescript-eslint/parser.

To Reproduce Steps to reproduce the behavior: 1 Setup eslint-plugin-rxjs rules 2 Setup graphql-eslint according to the docs(via overrides)

        {
            files: ['*.mutation.ts'],
            processor: '@graphql-eslint/graphql'
        },
        {
            files: ['*.graphql'],
            plugins: ['@graphql-eslint'],
            parser: '@graphql-eslint/eslint-plugin',
            parserOptions: {
                skipGraphQLConfig: true,
                schema: resolve(__dirname, './backends/client-api-backend/schema.graphql')
                // operations: [resolve(__dirname, './components/**/*.graphql')]
            },
            rules: {
                '@graphql-eslint/avoid-duplicate-fields': 'error',
                '@graphql-eslint/avoid-operation-name-prefix': 'error',
                '@graphql-eslint/avoid-typename-prefix': 'error',
                '@graphql-eslint/description-style': 'error',
                '@graphql-eslint/executable-definitions': 'error',
                '@graphql-eslint/fields-on-correct-type': 'error',
                '@graphql-eslint/fragments-on-composite-type': 'error',
                '@graphql-eslint/input-name': 'error',
                '@graphql-eslint/known-argument-names': 'error',
                '@graphql-eslint/known-directives': 'error',
                '@graphql-eslint/known-fragment-names': 'error',
                '@graphql-eslint/known-type-names': 'error',
                '@graphql-eslint/lone-anonymous-operation': 'error',
                '@graphql-eslint/lone-schema-definition': 'error',
                '@graphql-eslint/naming-convention': 'error',
                '@graphql-eslint/no-anonymous-operations': 'error',
                '@graphql-eslint/no-case-insensitive-enum-values-duplicates': 'error',
                '@graphql-eslint/no-deprecated': 'error',
                '@graphql-eslint/no-fragment-cycles': 'error',
                '@graphql-eslint/no-hashtag-description': 'error',
                '@graphql-eslint/no-operation-name-suffix': 'error',
                '@graphql-eslint/no-undefined-variables': 'error',
                '@graphql-eslint/no-unreachable-types': 'error',
                '@graphql-eslint/no-unused-fields': 'error',
                '@graphql-eslint/no-unused-fragments': 'error',
                '@graphql-eslint/no-unused-variables': 'error',
                '@graphql-eslint/one-field-subscriptions': 'error',
                '@graphql-eslint/overlapping-fields-can-be-merged': 'error',
                '@graphql-eslint/possible-fragment-spread': 'error',
                '@graphql-eslint/possible-type-extension': 'error',
                '@graphql-eslint/provided-required-arguments': 'error',
                '@graphql-eslint/require-deprecation-reason': 'error',
                '@graphql-eslint/require-id-when-available': 'error',
                '@graphql-eslint/scalar-leafs': 'error',
                // '@graphql-eslint/selection-set-depth': ['error', { maxDepth: 3 }],
                '@graphql-eslint/strict-id-in-types': 'error',
                '@graphql-eslint/unique-argument-names': 'error',
                '@graphql-eslint/unique-directive-names': 'error',
                '@graphql-eslint/unique-directive-names-per-location': 'error',
                '@graphql-eslint/unique-enum-value-names': 'error',
                '@graphql-eslint/unique-field-definition-names': 'error',
                '@graphql-eslint/unique-fragment-name': 'error',
                '@graphql-eslint/unique-input-field-names': 'error',
                '@graphql-eslint/unique-operation-name': 'error',
                '@graphql-eslint/unique-operation-types': 'error',
                '@graphql-eslint/unique-type-names': 'error',
                '@graphql-eslint/unique-variable-names': 'error',
                '@graphql-eslint/value-literals-of-correct-type': 'error',
                '@graphql-eslint/variables-are-input-types': 'error',
                '@graphql-eslint/variables-in-allowed-position': 'error'
            }
        }

Expected behavior GraphQL linter should work.

Environment:

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
mcmxcdevcommented, Aug 11, 2021

Solved it by restructuring eslint files to have all rules inside overrides.

1reaction
B2o5Tcommented, Aug 3, 2021

Nope, it’s important that you don’t have any rules configured at top level config, and to move all configurations into overrides section. Since JavaScript rules can’t run on GraphQL files and vice versa, if you have rules configured at the top level, they will try to also execute for all overrides, as ESLint’s configs cascade.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error when using with eslint-plugin-rxjs · Issue #544 - GitHub
We have https://www.npmjs.com/package/eslint-plugin-rxjs rules, and with configuration from the docs, we get following error: Error: Error while ...
Read more >
eslint-plugin-rxjs - npm
Start using eslint-plugin-rxjs in your project by running `npm i ... Forbids the calling of subscribe without specifying an error handler.
Read more >
Eslint import report TS+rxjs always failed on ...
Issue: When we generate esLint report by json format, and we define correct path in config of sonar we always get errors on...
Read more >
eslint-plugin-rxjs - npm Package Health Analysis - Snyk
Ensure you're using the healthiest npm packages. Snyk scans all the packages in your projects for vulnerabilities and provides automated fix advice.
Read more >
Eslint-plugin-rxjs - npm.io
Install the package using npm: npm install eslint-plugin-rxjs --save-dev. Configure the parser and the parserOptions for ESLint. Here, I use a .eslintrc.js ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found