Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

eslint-plugin-import: Enable more checks #2366

Merged
merged 1 commit into from
Jan 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ rules:
import/no-webpack-loader-syntax: error
import/no-self-import: error
import/no-cycle: off # TODO
import/no-useless-path-segments: off # TODO
import/no-useless-path-segments: error
import/no-relative-parent-imports: off

# Helpful warnings
Expand All @@ -98,12 +98,12 @@ rules:

# Style guide
# https://github.com/benmosher/eslint-plugin-import#style-guide
import/first: off # TODO
import/first: error
import/exports-last: off
import/no-duplicates: error
import/no-namespace: error
import/extensions: [error, never] # TODO: switch to ignorePackages
import/order: off # TODO
import/order: error
import/newline-after-import: error
import/prefer-default-export: off
import/max-dependencies: off
Expand Down
4 changes: 3 additions & 1 deletion resources/gen-changelog.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@

const util = require('util');
const https = require('https');
const { exec } = require('./utils');

const packageJSON = require('../package.json');

const { exec } = require('./utils');

const graphqlRequest = util.promisify(graphqlRequestImpl);
const labelsConfig = {
'PR: breaking change 💥': {
Expand Down
3 changes: 2 additions & 1 deletion src/language/__tests__/schema-parser-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ import { describe, it } from 'mocha';

import dedent from '../../jsutils/dedent';

import { kitchenSinkSDL } from '../../__fixtures__';

import { parse } from '../parser';

import toJSONDeep from './toJSONDeep';
import { kitchenSinkSDL } from '../../__fixtures__';

function expectSyntaxError(text) {
return expect(() => parse(text)).to.throw();
Expand Down
6 changes: 3 additions & 3 deletions src/language/printLocation.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// @flow strict

import { type Location } from '../language/ast';
import { type Source } from '../language/source';
import { type SourceLocation, getLocation } from '../language/location';
import { type Location } from './ast';
import { type Source } from './source';
import { type SourceLocation, getLocation } from './location';

/**
* Render a helpful description of the location in the GraphQL Source document.
Expand Down
17 changes: 8 additions & 9 deletions src/type/__tests__/validation-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@ import inspect from '../../jsutils/inspect';

import { parse } from '../../language/parser';

import { GraphQLSchema } from '../../type/schema';
import { GraphQLString } from '../../type/scalars';
import { GraphQLDirective } from '../../type/directives';
import { extendSchema } from '../../utilities/extendSchema';
import { buildSchema } from '../../utilities/buildASTSchema';

import { GraphQLSchema } from '../schema';
import { GraphQLString } from '../scalars';
import { GraphQLDirective } from '../directives';
import { validateSchema, assertValidSchema } from '../validate';
import {
type GraphQLNamedType,
type GraphQLInputType,
Expand All @@ -23,12 +27,7 @@ import {
GraphQLUnionType,
GraphQLEnumType,
GraphQLInputObjectType,
} from '../../type/definition';

import { extendSchema } from '../../utilities/extendSchema';
import { buildSchema } from '../../utilities/buildASTSchema';

import { validateSchema, assertValidSchema } from '../validate';
} from '../definition';

const SomeScalarType = new GraphQLScalarType({ name: 'SomeScalar' });

Expand Down
2 changes: 1 addition & 1 deletion src/utilities/schemaPrinter.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import {
isInputObjectType,
} from '../type/definition';

import { astFromValue } from '../utilities/astFromValue';
import { astFromValue } from './astFromValue';

type Options = {|
/**
Expand Down
17 changes: 9 additions & 8 deletions src/validation/specifiedRules.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,15 @@ import { OverlappingFieldsCanBeMerged } from './rules/OverlappingFieldsCanBeMerg
// Spec Section: "Input Object Field Uniqueness"
import { UniqueInputFieldNames } from './rules/UniqueInputFieldNames';

// SDL-specific validation rules
import { LoneSchemaDefinition } from './rules/LoneSchemaDefinition';
import { UniqueOperationTypes } from './rules/UniqueOperationTypes';
import { UniqueTypeNames } from './rules/UniqueTypeNames';
import { UniqueEnumValueNames } from './rules/UniqueEnumValueNames';
import { UniqueFieldDefinitionNames } from './rules/UniqueFieldDefinitionNames';
import { UniqueDirectiveNames } from './rules/UniqueDirectiveNames';
import { PossibleTypeExtensions } from './rules/PossibleTypeExtensions';

/**
* This set includes all validation rules defined by the GraphQL spec.
*
Expand Down Expand Up @@ -119,14 +128,6 @@ export const specifiedRules = Object.freeze([
UniqueInputFieldNames,
]);

import { LoneSchemaDefinition } from './rules/LoneSchemaDefinition';
import { UniqueOperationTypes } from './rules/UniqueOperationTypes';
import { UniqueTypeNames } from './rules/UniqueTypeNames';
import { UniqueEnumValueNames } from './rules/UniqueEnumValueNames';
import { UniqueFieldDefinitionNames } from './rules/UniqueFieldDefinitionNames';
import { UniqueDirectiveNames } from './rules/UniqueDirectiveNames';
import { PossibleTypeExtensions } from './rules/PossibleTypeExtensions';

/**
* @internal
*/
Expand Down