@graphql-eslint/eslint-plugin 3.1.0-alpha-27dcb49.0 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.js +4 -3
  2. package/index.mjs +4 -3
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -1845,7 +1845,7 @@ const HASHTAG_COMMENT = 'HASHTAG_COMMENT';
1845
1845
  const rule$9 = {
1846
1846
  meta: {
1847
1847
  messages: {
1848
- [HASHTAG_COMMENT]: 'Using hashtag (#) for adding GraphQL descriptions is not allowed. Prefer using """ for multiline, or " for a single line description.',
1848
+ [HASHTAG_COMMENT]: `Using hashtag (#) for adding GraphQL descriptions is not allowed. Prefer using """ for multiline, or " for a single line description.`,
1849
1849
  },
1850
1850
  docs: {
1851
1851
  description: 'Requires to use `"""` or `"` for adding a GraphQL description instead of `#`.\nAllows to use hashtag for comments, as long as it\'s not attached to an AST definition.',
@@ -1892,14 +1892,15 @@ const rule$9 = {
1892
1892
  schema: [],
1893
1893
  },
1894
1894
  create(context) {
1895
+ const selector = `${graphql.Kind.DOCUMENT}[definitions.0.kind!=/^(${graphql.Kind.OPERATION_DEFINITION}|${graphql.Kind.FRAGMENT_DEFINITION})$/]`;
1895
1896
  return {
1896
- Document(node) {
1897
+ [selector](node) {
1897
1898
  const rawNode = node.rawNode();
1898
1899
  let token = rawNode.loc.startToken;
1899
1900
  while (token !== null) {
1900
1901
  const { kind, prev, next, value, line, column } = token;
1901
1902
  if (kind === graphql.TokenKind.COMMENT && prev && next) {
1902
- const isEslintComment = value.trimLeft().startsWith('eslint');
1903
+ const isEslintComment = value.trimStart().startsWith('eslint');
1903
1904
  const linesAfter = next.line - line;
1904
1905
  if (!isEslintComment && line !== prev.line && next.kind === graphql.TokenKind.NAME && linesAfter < 2) {
1905
1906
  context.report({
package/index.mjs CHANGED
@@ -1839,7 +1839,7 @@ const HASHTAG_COMMENT = 'HASHTAG_COMMENT';
1839
1839
  const rule$9 = {
1840
1840
  meta: {
1841
1841
  messages: {
1842
- [HASHTAG_COMMENT]: 'Using hashtag (#) for adding GraphQL descriptions is not allowed. Prefer using """ for multiline, or " for a single line description.',
1842
+ [HASHTAG_COMMENT]: `Using hashtag (#) for adding GraphQL descriptions is not allowed. Prefer using """ for multiline, or " for a single line description.`,
1843
1843
  },
1844
1844
  docs: {
1845
1845
  description: 'Requires to use `"""` or `"` for adding a GraphQL description instead of `#`.\nAllows to use hashtag for comments, as long as it\'s not attached to an AST definition.',
@@ -1886,14 +1886,15 @@ const rule$9 = {
1886
1886
  schema: [],
1887
1887
  },
1888
1888
  create(context) {
1889
+ const selector = `${Kind.DOCUMENT}[definitions.0.kind!=/^(${Kind.OPERATION_DEFINITION}|${Kind.FRAGMENT_DEFINITION})$/]`;
1889
1890
  return {
1890
- Document(node) {
1891
+ [selector](node) {
1891
1892
  const rawNode = node.rawNode();
1892
1893
  let token = rawNode.loc.startToken;
1893
1894
  while (token !== null) {
1894
1895
  const { kind, prev, next, value, line, column } = token;
1895
1896
  if (kind === TokenKind.COMMENT && prev && next) {
1896
- const isEslintComment = value.trimLeft().startsWith('eslint');
1897
+ const isEslintComment = value.trimStart().startsWith('eslint');
1897
1898
  const linesAfter = next.line - line;
1898
1899
  if (!isEslintComment && line !== prev.line && next.kind === TokenKind.NAME && linesAfter < 2) {
1899
1900
  context.report({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-eslint/eslint-plugin",
3
- "version": "3.1.0-alpha-27dcb49.0",
3
+ "version": "3.1.0",
4
4
  "sideEffects": false,
5
5
  "peerDependencies": {
6
6
  "graphql": "^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"