Mono-repo for various eslint custom language parsers / rules etc.
Ready to use:
Experimental WIP:
Mono-repo for various eslint custom language parsers / rules etc.
Mono-repo for various eslint custom language parsers / rules etc.
Ready to use:
Experimental WIP:
#eslint-disable - description
#eslint-enable - description
#eslint-enable <some-rule>, <some-other-rule> - description
query {
all {
#eslint-disable-next-line <optional-rule> - description
name #eslint-disable-line <optional-rule> - description
}
}
pathOf(eslintNode | graphqlNode)
TypeInfo is quite often going to be useful, and having downstreams use it makes linking quite often painful as graphql will throw if it detects multiple instances in its node modules.
index.js
Hi,
I have successfully (somehow) working the eslint-plugin-graphql
on my project, it warms be about deprecated stuff and non-existing queries/mutation against the schema.graphql, thats very nice.
But it is not warning be about nice-to-have code style for example:
someQuery() {
entity{
value
}
}
should ideally warn me be about NOT having an space between entity
and the opening brace {
so the "correct" format should look like:
someQuery() {
entity {
value
}
}
Isn't this possible at all? can the actual plugin catch those or should(could) a custom rule be created?
This particular line breaks when parsing something like
query {
listOfWat { stuff }
... { helloWorld name }
}`
Stracktrace:
TypeError: Cannot read property 'name' of undefined
Occurred while linting <input>:5
at Object.pathOf (node_modules/@eslint-ast/eslint-plugin-graphql/parser.js:94:58)
I encountered this while writing a eslint rule using context.parserServices.pathOf
.
Rule:
module.exports = {
meta: {
type: 'problem',
messages: {
pemberlyApiInfraFieldSelectionNotAllowed:
'Fail',
},
docs: {
description: ``,
category: 'problem',
},
fixable: 'code',
},
create(context) {
return {
Field(node) {
context.parserServices.pathOf(node.parent)
},
};
},
};
Test
const rule = require('../../../lib/rules/test-rule');
const RuleTester = require('eslint').RuleTester;
const ruleTester = new RuleTester({
parser: require.resolve('@eslint-ast/eslint-plugin-graphql/parser'),
parserOptions: {
schema: `${__dirname}/../../fixtures/schema.graphql`,
},
});
ruleTester.run('no-pemberly-api-infra-fields _type', rule, {
valid: [ ],
invalid: [
{
code: `
query {
listOfWat { _type }
... { _type name }
}`,
errors: [ ],
output: `
query {
... { name }
}`,
},
],
});
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.