Skip to content

Commit

Permalink
update prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
dimaMachina committed Aug 29, 2023
1 parent 296f700 commit e6ce80a
Show file tree
Hide file tree
Showing 47 changed files with 163 additions and 166 deletions.
4 changes: 2 additions & 2 deletions .changeset/@graphql-eslint_eslint-plugin-1813-dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
dependencies updates:

- Updated dependency
[`graphql-config@^4.5.0` ↗︎](https://www.npmjs.com/package/graphql-config/v/4.5.0) (from `^4.4.0`,
in `dependencies`)
[`graphql-config@^4.5.0` ↗︎](https://www.npmjs.com/package/graphql-config/v/4.5.0) (from
`^4.4.0`, in `dependencies`)
- Removed dependency
[`@babel/code-frame@^7.18.6` ↗︎](https://www.npmjs.com/package/@babel/code-frame/v/7.18.6) (from
`dependencies`)
Expand Down
5 changes: 1 addition & 4 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
dist/
packages/plugin/__tests__/__snapshots__/
examples/prettier/invalid.graphql
examples/prettier/invalid.js
pnpm-lock.yaml
.bob/
.next/
out/

# prettier ignore doesn't work
website/src/pages/docs/configs.mdx
2 changes: 1 addition & 1 deletion .prettierrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ const { plugins, ...prettierConfig } = require('@theguild/prettier-config');

module.exports = {
...prettierConfig,
plugins: [...plugins, require('prettier-plugin-tailwindcss')],
plugins: [...plugins, 'prettier-plugin-tailwindcss'],
};
2 changes: 1 addition & 1 deletion examples/code-file/eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as graphqlESLint from '@graphql-eslint/eslint-plugin';
import js from '@eslint/js';
import * as graphqlESLint from '@graphql-eslint/eslint-plugin';

export default [
{
Expand Down
2 changes: 1 addition & 1 deletion examples/graphql-config/eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as graphqlESLint from '@graphql-eslint/eslint-plugin';
import js from '@eslint/js';
import * as graphqlESLint from '@graphql-eslint/eslint-plugin';

export default [
{
Expand Down
2 changes: 1 addition & 1 deletion examples/monorepo/eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as graphqlESLint from '@graphql-eslint/eslint-plugin';
import js from '@eslint/js';
import * as graphqlESLint from '@graphql-eslint/eslint-plugin';

const SCHEMA_PATH = 'server/**/*.gql';

Expand Down
4 changes: 2 additions & 2 deletions examples/prettier/eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as graphqlESLint from '@graphql-eslint/eslint-plugin';
import prettierPlugin from 'eslint-plugin-prettier';
import prettierConfig from 'eslint-config-prettier';
import prettierPlugin from 'eslint-plugin-prettier';
import js from '@eslint/js';
import * as graphqlESLint from '@graphql-eslint/eslint-plugin';

export default [
{
Expand Down
2 changes: 1 addition & 1 deletion examples/programmatic/eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as graphqlESLint from '@graphql-eslint/eslint-plugin';
import js from '@eslint/js';
import * as graphqlESLint from '@graphql-eslint/eslint-plugin';

export default [
{
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"create-rule": "tsx scripts/create-rule.ts",
"generate:configs": "tsx scripts/generate-configs.ts",
"lint": "eslint --ignore-path .gitignore --cache .",
"lint:prettier": "prettier --cache --check .",
"lint:prettier": "prettier --ignore-path .gitignore --ignore-path .prettierignore --cache --check .",
"prebuild": "rimraf tsconfig.tsbuildinfo",
"prerelease": "NODE_ENV=production pnpm build",
"prettier": "pnpm lint:prettier --write",
Expand All @@ -28,7 +28,7 @@
"@changesets/cli": "2.26.2",
"@graphql-tools/utils": "9.2.1",
"@theguild/eslint-config": "0.11.0",
"@theguild/prettier-config": "1.2.0",
"@theguild/prettier-config": "2.0.1",
"@types/dedent": "0.7.0",
"@types/node": "18.17.12",
"bob-the-bundler": "7.0.1",
Expand All @@ -41,8 +41,8 @@
"husky": "8.0.3",
"jest-snapshot-serializer-raw": "2.0.0",
"json-schema-to-markdown": "1.1.1",
"prettier": "2.8.8",
"prettier-plugin-tailwindcss": "0.2.8",
"prettier": "3.0.3",
"prettier-plugin-tailwindcss": "0.5.3",
"rimraf": "5.0.1",
"tsup": "^7.1.0",
"tsx": "3.12.7",
Expand Down
9 changes: 5 additions & 4 deletions packages/plugin/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,13 @@
- [#1813](https://github.com/B2o5T/graphql-eslint/pull/1813)
[`1c2d220`](https://github.com/B2o5T/graphql-eslint/commit/1c2d2205a8eb1d7446e4101bb4300e6e71120e42)
Thanks [@B2o5T](https://github.com/B2o5T)! - dependencies updates:
- Updated dependency
[`graphql-config@^4.5.0` ↗︎](https://www.npmjs.com/package/graphql-config/v/4.5.0) (from
`^4.4.0`, in `dependencies`)
- Removed dependency
[`@babel/code-frame@^7.18.6` ↗︎](https://www.npmjs.com/package/@babel/code-frame/v/7.18.6) (from
`dependencies`)
[`@babel/code-frame@^7.18.6` ↗︎](https://www.npmjs.com/package/@babel/code-frame/v/7.18.6)
(from `dependencies`)
- Removed dependency [`chalk@^4.1.2` ↗︎](https://www.npmjs.com/package/chalk/v/4.1.2) (from
`dependencies`)
- Removed dependency [`tslib@^2.4.1` ↗︎](https://www.npmjs.com/package/tslib/v/2.4.1) (from
Expand All @@ -138,8 +139,8 @@
Thanks [@B2o5T](https://github.com/B2o5T)! - dependencies updates:
- Removed dependency
[`@babel/code-frame@^7.18.6` ↗︎](https://www.npmjs.com/package/@babel/code-frame/v/7.18.6) (from
`dependencies`)
[`@babel/code-frame@^7.18.6` ↗︎](https://www.npmjs.com/package/@babel/code-frame/v/7.18.6)
(from `dependencies`)
## 3.20.1
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin/__tests__/executable-definitions.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { GRAPHQL_JS_VALIDATIONS } from '../src/rules/graphql-js-validation';
import { ruleTester, ParserOptionsForTests } from './test-utils';
import { ParserOptionsForTests, ruleTester } from './test-utils';

const TEST_SCHEMA = /* GraphQL */ `
type Query {
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin/__tests__/fields-on-correct-type.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { DEFAULT_CONFIG, ParserOptionsForTests } from './test-utils';
// @ts-expect-error -- add `"type": "module"` to `package.json` to fix this
import { RuleTester } from '@theguild/eslint-rule-tester';
import { GRAPHQL_JS_VALIDATIONS } from '../src/rules/graphql-js-validation';
import { DEFAULT_CONFIG, ParserOptionsForTests } from './test-utils';

const ruleTester = new RuleTester<ParserOptionsForTests>({
...DEFAULT_CONFIG,
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin/__tests__/known-directives.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @ts-expect-error -- add `"type": "module"` to `package.json` to fix this
import { RuleTester } from '@theguild/eslint-rule-tester';
import { DEFAULT_CONFIG, ParserOptionsForTests } from './test-utils';
import { GRAPHQL_JS_VALIDATIONS } from '../src/rules/graphql-js-validation';
import { DEFAULT_CONFIG, ParserOptionsForTests } from './test-utils';

const ruleTester = new RuleTester<ParserOptionsForTests>({
...DEFAULT_CONFIG,
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin/__tests__/known-fragment-names.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { join } from 'node:path';
import { ruleTester } from './test-utils';
import { GRAPHQL_JS_VALIDATIONS } from '../src/rules/graphql-js-validation';
import { ruleTester } from './test-utils';

ruleTester.run('known-fragment-names', GRAPHQL_JS_VALIDATIONS['known-fragment-names'], {
valid: [
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin/__tests__/no-undefined-variables.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { join } from 'node:path';
import { ruleTester } from './test-utils';
import { GRAPHQL_JS_VALIDATIONS } from '../src/rules/graphql-js-validation';
import { ruleTester } from './test-utils';

ruleTester.run('no-undefined-variables', GRAPHQL_JS_VALIDATIONS['no-undefined-variables'], {
valid: [],
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin/__tests__/no-unused-fields.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { rule } from '../src/rules/no-unused-fields';
// @ts-expect-error -- add `"type": "module"` to `package.json` to fix this
import { RuleTester } from '@theguild/eslint-rule-tester';
import { rule } from '../src/rules/no-unused-fields';
import { DEFAULT_CONFIG, ParserOptionsForTests } from './test-utils';

const SCHEMA = /* GraphQL */ `
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin/__tests__/no-unused-fragments.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { join } from 'node:path';
import { ruleTester } from './test-utils';
import { GRAPHQL_JS_VALIDATIONS } from '../src/rules/graphql-js-validation';
import { ruleTester } from './test-utils';

ruleTester.run('no-unused-fragments', GRAPHQL_JS_VALIDATIONS['no-unused-fragments'], {
valid: [
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin/__tests__/no-unused-variables.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { join } from 'node:path';
import { ruleTester } from './test-utils';
import { GRAPHQL_JS_VALIDATIONS } from '../src/rules/graphql-js-validation';
import { ruleTester } from './test-utils';

ruleTester.run('no-unused-variables', GRAPHQL_JS_VALIDATIONS['no-unused-variables'], {
valid: [
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin/__tests__/possible-type-extension.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { join } from 'node:path';
import { ParserOptionsForTests, ruleTester } from './test-utils';
import { GRAPHQL_JS_VALIDATIONS } from '../src/rules/graphql-js-validation';
import { ParserOptionsForTests, ruleTester } from './test-utils';

const useUserSchema = (code: string) => {
return {
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin/__tests__/require-description.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { rule, RuleOptions, RULE_ID } from '../src/rules/require-description';
import { rule, RULE_ID, RuleOptions } from '../src/rules/require-description';
import { ParserOptionsForTests, ruleTester } from './test-utils';

const OPERATION = { OperationDefinition: true };
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin/__tests__/rules.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { configs, parseForESLint, rules } from '@graphql-eslint/eslint-plugin';
import eslintExperimentalApis from 'eslint/use-at-your-own-risk';
import { configs, parseForESLint, rules } from '@graphql-eslint/eslint-plugin';
import { ParserOptionsForTests } from './test-utils';

// @ts-expect-error we need to wait when ESLint publish correct types
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin/src/configs/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { ConfigName } from '../types.js';
import operationsAllConfig from './operations-all.js';
import operationsRecommendedConfig from './operations-recommended.js';
import schemaAllConfig from './schema-all.js';
import schemaRecommendedConfig from './schema-recommended.js';
import relayConfig from './schema-relay.js';
import { ConfigName } from '../types.js';

export const configs = {
'schema-recommended': schemaRecommendedConfig,
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin/src/documents.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { resolve } from 'node:path';
import { Source } from '@graphql-tools/utils';
import debugFactory from 'debug';
import fg from 'fast-glob';
import { GraphQLProjectConfig } from 'graphql-config';
import { Source } from '@graphql-tools/utils';
import { ModuleCache } from './cache.js';
import { Pointer } from './types.js';

Expand Down
2 changes: 1 addition & 1 deletion packages/plugin/src/graphql-config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import path from 'node:path';
import { CodeFileLoader } from '@graphql-tools/code-file-loader';
import debugFactory from 'debug';
import { GraphQLConfig, GraphQLExtensionDeclaration, loadConfigSync } from 'graphql-config';
import { CodeFileLoader } from '@graphql-tools/code-file-loader';
import { ParserOptions } from './types.js';

const debug = debugFactory('graphql-eslint:graphql-config');
Expand Down
6 changes: 3 additions & 3 deletions packages/plugin/src/parser.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { parseGraphQLSDL, Source } from '@graphql-tools/utils';
import debugFactory from 'debug';
import { buildSchema, GraphQLError } from 'graphql';
import { GraphQLProjectConfig, IGraphQLProject } from 'graphql-config';
import { parseGraphQLSDL, Source } from '@graphql-tools/utils';
import { getDocuments } from './documents.js';
import { convertToESTree, extractComments, extractTokens } from './estree-converter/index.js';
import { loadGraphQLConfig } from './graphql-config.js';
import { getSchema } from './schema.js';
import { getSiblings } from './siblings.js';
import { GraphQLESLintParseResult, ParserOptions, Schema } from './types.js';
import { CWD, VIRTUAL_DOCUMENT_REGEX } from './utils.js';
import { GraphQLProjectConfig, IGraphQLProject } from 'graphql-config';
import { getDocuments } from './documents.js';

const debug = debugFactory('graphql-eslint:parser');

Expand Down
4 changes: 2 additions & 2 deletions packages/plugin/src/processor.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { relative } from 'node:path';
import { Linter } from 'eslint';
import { GraphQLConfig } from 'graphql-config';
import {
gqlPluckFromCodeStringSync,
GraphQLTagPluckOptions,
} from '@graphql-tools/graphql-tag-pluck';
import { asArray } from '@graphql-tools/utils';
import { Linter } from 'eslint';
import { GraphQLConfig } from 'graphql-config';
import { loadOnDiskGraphQLConfig } from './graphql-config.js';
import { CWD, REPORT_ON_FIRST_CHARACTER, truthy } from './utils.js';

Expand Down
2 changes: 1 addition & 1 deletion packages/plugin/src/rules/graphql-js-validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import {
VariablesInAllowedPositionRule,
} from 'graphql/validation/index.js';
import { validateSDL } from 'graphql/validation/validate.js';
import { SDLValidationRule } from 'graphql/validation/ValidationContext';
import { JSONSchema } from 'json-schema-to-ts';
import { GraphQLESLintRule, GraphQLESLintRuleContext, RuleDocsInfo } from '../types.js';
import {
Expand All @@ -53,7 +54,6 @@ import {
requireGraphQLSchemaFromContext,
requireSiblingsOperations,
} from '../utils.js';
import { SDLValidationRule } from 'graphql/validation/ValidationContext';

type GraphQLJSRule = ValidationRule | SDLValidationRule;

Expand Down
2 changes: 1 addition & 1 deletion packages/plugin/src/rules/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
* 🚨 IMPORTANT! Do not manually modify this file. Run: `yarn generate-configs`
*/

import { GRAPHQL_JS_VALIDATIONS } from './graphql-js-validation.js';
import { rule as alphabetize } from './alphabetize.js';
import { rule as descriptionStyle } from './description-style.js';
import { GRAPHQL_JS_VALIDATIONS } from './graphql-js-validation.js';
import { rule as inputName } from './input-name.js';
import { rule as loneExecutableDefinition } from './lone-executable-definition.js';
import { rule as matchDocumentFilename } from './match-document-filename.js';
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin/src/rules/naming-convention.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ASTKindToNode, Kind, NameNode } from 'graphql';
import { FromSchema } from 'json-schema-to-ts';
import { GraphQLESTreeNode } from '../estree-converter/index.js';
import { GraphQLESLintRule, ValueOf, GraphQLESLintRuleListener } from '../types.js';
import { GraphQLESLintRule, GraphQLESLintRuleListener, ValueOf } from '../types.js';
import {
ARRAY_DEFAULT_OPTIONS,
convertCase,
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin/src/rules/relay-edge-types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { getDocumentNodeFromSchema } from '@graphql-tools/utils';
import {
ASTVisitor,
GraphQLSchema,
Expand All @@ -11,6 +10,7 @@ import {
visit,
} from 'graphql';
import { FromSchema } from 'json-schema-to-ts';
import { getDocumentNodeFromSchema } from '@graphql-tools/utils';
import { GraphQLESTreeNode } from '../estree-converter/index.js';
import { GraphQLESLintRule, GraphQLESLintRuleListener } from '../types.js';
import { getTypeName, requireGraphQLSchemaFromContext } from '../utils.js';
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin/src/rules/require-description.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getRootTypeNames } from '@graphql-tools/utils';
import { ASTKindToNode, Kind, TokenKind } from 'graphql';
import { getRootTypeNames } from '@graphql-tools/utils';
import { GraphQLESTreeNode } from '../estree-converter/index.js';
import { GraphQLESLintRule, ValueOf } from '../types.js';
import {
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin/src/rules/require-import-fragment.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import path from 'node:path';
import { NameNode } from 'graphql';
import { requireSiblingsOperations } from '../utils.js';
import { GraphQLESTreeNode } from '../estree-converter/index.js';
import { GraphQLESLintRule } from '../types.js';
import { requireSiblingsOperations } from '../utils.js';

const RULE_ID = 'require-import-fragment';
const SUGGESTION_ID = 'add-import-expression';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Kind, ObjectTypeDefinitionNode } from 'graphql';
import { GraphQLESTreeNode } from '../estree-converter/index.js';
import { GraphQLESLintRule } from '../types.js';
import { getNodeName, requireGraphQLSchemaFromContext, truthy } from '../utils.js';
import { GraphQLESTreeNode } from '../estree-converter/index.js';

const RULE_ID = 'require-nullable-result-in-root';

Expand Down
2 changes: 1 addition & 1 deletion packages/plugin/src/rules/require-selections.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { asArray } from '@graphql-tools/utils';
import * as ESTree from 'estree';
import {
ASTNode,
Expand All @@ -13,6 +12,7 @@ import {
visitWithTypeInfo,
} from 'graphql';
import { FromSchema } from 'json-schema-to-ts';
import { asArray } from '@graphql-tools/utils';
import { getBaseType, GraphQLESTreeNode } from '../estree-converter/index.js';
import { GraphQLESLintRule, OmitRecursively, ReportDescriptor } from '../types.js';
import {
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin/src/siblings.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { Source } from '@graphql-tools/utils';
import {
FragmentDefinitionNode,
Kind,
Expand All @@ -7,6 +6,7 @@ import {
SelectionSetNode,
visit,
} from 'graphql';
import { Source } from '@graphql-tools/utils';
import { logger } from './utils.js';

export type FragmentSource = { filePath: string; document: FragmentDefinitionNode };
Expand Down
6 changes: 3 additions & 3 deletions packages/plugin/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { AST, Linter, Rule } from 'eslint';
import * as ESTree from 'estree';
import { GraphQLSchema, ASTKindToNode } from 'graphql';
import { ASTKindToNode, GraphQLSchema } from 'graphql';
import { IGraphQLConfig } from 'graphql-config';
import { JSONSchema } from 'json-schema-to-ts';
import { SiblingOperations } from './siblings.js';
import { GraphQLESTreeNode } from './estree-converter/index.js';
import { IGraphQLConfig } from 'graphql-config';
import { SiblingOperations } from './siblings.js';

export type Schema = GraphQLSchema | null;
export type Pointer = string | string[];
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { AST } from 'eslint';
import { Position } from 'estree';
import { ASTNode, GraphQLSchema, Kind } from 'graphql';
import lowerCase from 'lodash.lowercase';
import { GraphQLESTreeNode } from './estree-converter/index.js';
import { SiblingOperations } from './siblings.js';
import { GraphQLESLintRuleContext } from './types.js';
import { GraphQLESTreeNode } from './estree-converter/index.js';

export function requireSiblingsOperations(
ruleId: string,
Expand Down
Loading

0 comments on commit e6ce80a

Please sign in to comment.