Comments (5)
ESlint has a feature for this: https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions
Suggestions are not fixes, they will not be applied automatically, but will require the user to take an action to apply them. It was added specifically for the cases where there's no way to be sure that automatic change will make sense to the end user.
Finding duplicate code, however, is an np-complete problem, that's not trivial to implement even with a low guarantee.
from graphql-eslint.
This sounds very interesting. Any idea how can we locate those in a robust way what won't create incorrect results?
We can find similar selection sets (with TypeInfo) and suggest on moving to fragments, but that might not fit all use-cases...
from graphql-eslint.
Some of them already implemented in GraphQL Altair: altair-graphql/altair#745 (comment).
from graphql-eslint.
One other thing to keep in mind: ESLint operates on one file at a time, so if you have duplicate code across multiple files, ESLint will not be able to handle that, it will only be able to make a suggestion if it sees duplicate code in the same file.
from graphql-eslint.
no-one-place-fragments
will be included in next release 3.14.0 to catch
find fragments that are used only in one place and suggest inline them.
from graphql-eslint.
Related Issues (20)
- Ability to sort nodes last in group HOT 2
- error Definition for rule '@graphql-eslint/require-selections' was not found HOT 1
- Project script lint fails HOT 1
- Ignore require-description for root types
- Multi-project configurations cannot be linted all at once HOT 9
- require-import-fragment doesn't work on Windows HOT 1
- Add ignore list to `no-unused-fields` rule
- Is there a rule to enforce the usage of `@contact` directive on the schema? HOT 1
- Support the fragment spread group when defining alphabetize rule's groups HOT 2
- linter does not pass checks
- test in watch mode does not receive any input
- Eslint 9 compatibility HOT 1
- bit.ly links broken?
- Feedback for “Getting Started”
- `require-selections` does not report issues on `FragmentSpread`s within `GraphQLUnionType`
- Bug report template repro link broken HOT 1
- Flat File, Vue, ESM: require is not defined
- node related types
- require-id-when-available - options not being passed through correctly
- Support deprecated input values HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from graphql-eslint.