Skip to content

Ignoring a literal file with eslint-disable #102

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
pleunv opened this issue Jan 16, 2018 · 5 comments
Open

Ignoring a literal file with eslint-disable #102

pleunv opened this issue Jan 16, 2018 · 5 comments

Comments

@pleunv
Copy link

pleunv commented Jan 16, 2018

Hey guys, thanks for this plugin! Probably going to make our life a lot easier :)

I'm having a couple problematic queries that I cannot immediately change in order to be validated (mostly unions with field type conflicts behind the same alias - query executes, but the validator is not a big fan), and I noticed that # eslint-disable does not seem to have any effect right now. Would it be feasible to add support for this, or is there currently a workaround?

@bdrobinson
Copy link

It would also be useful to do this on a per-line basis. Would this be difficult?

const query = gql`
  {
    whatever {
       field # eslint-disable-line
    }
  }
`

@arkwright
Copy link

arkwright commented Aug 24, 2019

In case it helps to unblock anyone, I just tested the following locally on eslint-plugin-graphql@3.0.3.

This does not work:

// eslint-disable-next-line graphql/no-deprecated-fields
const query = gql`
  {
    whatever {
       deprecatedField
    }
  }
`;

This works:

/* eslint-disable graphql/no-deprecated-fields */
const query = gql`
  {
    whatever {
       deprecatedField
    }
  }
`;
/* eslint-enable graphql/no-deprecated-fields */

Unfortunately this means that until one can migrate away from the deprecated field, any other fields within this query which are subsequently deprecated will not be caught by the linter.

@cosmonot1
Copy link

Running into the same issue with # import and fragments. Specifically, the graphql/template-strings rule is complaining about unused variables. The variables are used in the fragments.

#import "./serverOnlyFragment.graphql"
#import "./sharedFragment.graphql"

# eslint-disable graphql/template-strings
# eslint-disable-next-line graphql/template-strings
query HomePageServer(    # eslint-disable-line graphql/template-strings
    # eslint-disable-next-line graphql/template-strings
    $isAuthenticated: Boolean!     # eslint-disable-line graphql/template-strings
    $gpid: Long!    # eslint-disable-line graphql/template-strings
    $latitude: Float!    # eslint-disable-line graphql/template-strings
    $longitude: Float!    # eslint-disable-line graphql/template-strings
    $tld: String!    # eslint-disable-line graphql/template-strings
) {
    ...ServerOnlyFragment
    ...SharedFragment
}

Expected # eslint-disable graphql/template-strings, # eslint-disable-line graphql/template-strings, or # eslint-disable-next-line graphql/template-strings to disable the rule, but it doesn't.

Would be stoked to get support for eslint-disable functionality, or of exhaustive checking of imports for rules

@paul-vd
Copy link

paul-vd commented Nov 5, 2021

Also having the same is as @cosmonot1

@margintop5px
Copy link

+1 for per-line disabling

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants