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

lint renderExample.js file, cleanup .eslintignore file #3034

Merged
merged 1 commit into from
Feb 24, 2023
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
32 changes: 0 additions & 32 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,30 +1,6 @@
################################################################################
#
# First things first; we need to ignore our built files. To achive this, we
# have to do a bit of an ignore dance where we ignore everything, and then
# specifically un-ignore the source code, configuration files, etc.
#
# First: ignore FILES (not folders!)
/{packages,examples}/**/*.{js,jsx,ts,tsx}

#
# Now un-ignore source code, tests, configuration, etc
!/{packages,examples}/*/{src,cypress,resources}/**

# CRA example has its own eslint config
examples/graphiql-create-react-app

!.eslintrc.js
!babel.config.js
#
# End of the ignore dance.
#
################################################################################

# Regular eslintignore configuration follows.

# ESLint automatically ignores node_modules _in the root_, so we only need to specify nested node_modules
**/node_modules
/packages/graphiql/graphiql.*

# Build artifacts
Expand All @@ -36,12 +12,7 @@ examples/graphiql-create-react-app
**/typedoc
**/monaco
**/webpack
packages/graphiql/webpack
packages/graphiql/storybook
packages/graphiql/lsp
packages/graphiql/monaco
packages/graphiql/*.html
**/renderExample.js
**/*.min.js
**/coverage/
.nyc_output/
Expand All @@ -61,9 +32,6 @@ working-group/
**/codemirror-graphql/cm6-legacy
**/codemirror-graphql/__tests__

# Vendored files
/packages/graphiql/test/vendor

.changeset/*.md
storybook-static/

Expand Down
14 changes: 8 additions & 6 deletions packages/graphiql/resources/renderExample.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* global React, ReactDOM, GraphiQL, GraphQLVersion */

/**
* UMD GraphiQL Example
*
Expand All @@ -11,9 +13,8 @@
*/

// Parse the search string to get url parameters.
var search = window.location.search;
var parameters = {};
search
window.location.search
.substr(1)
.split('&')
.forEach(function (entry) {
Expand Down Expand Up @@ -73,13 +74,14 @@ function getSchemaUrl() {
// This supports an e2e test which ensures that invalid schemas do not load.
if (parameters.bad === 'true') {
return '/bad/graphql';
} else if (parameters['http-error'] === 'true') {
}
if (parameters['http-error'] === 'true') {
return '/http-error/graphql';
} else if (parameters['graphql-error'] === 'true') {
}
if (parameters['graphql-error'] === 'true') {
return '/graphql-error/graphql';
} else {
return '/graphql';
}
return '/graphql';
}
return '/.netlify/functions/schema-demo';
}
Expand Down
8 changes: 1 addition & 7 deletions packages/graphiql/test/beforeDevServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,13 @@ const { schema: badSchema } = require('./bad-schema');
module.exports = function beforeDevServer(app, _server, _compiler) {
// GraphQL Server
app.post('/graphql', graphqlHTTP({ schema }));
app.get('/graphql', graphqlHTTP({ schema }));

app.post('/bad/graphql', (_req, res, next) => {
res.json({ data: badSchema });
next();
});

app.get(
'/graphql',
graphqlHTTP({
schema,
}),
);

app.use('/images', express.static(path.join(__dirname, 'images')));

app.use(
Expand Down
12 changes: 3 additions & 9 deletions packages/graphiql/test/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,7 @@ const UnionFirst = new GraphQLObjectType({
},
first: {
type: new GraphQLList(TestInterface),
resolve: () => {
return true;
},
resolve: () => true,
},
}),
interfaces: [TestInterface],
Expand All @@ -113,9 +111,7 @@ const UnionSecond = new GraphQLObjectType({
},
second: {
type: TestInterface,
resolve: () => {
return false;
},
resolve: () => false,
},
}),
interfaces: [TestInterface],
Expand Down Expand Up @@ -295,9 +291,7 @@ const TestType = new GraphQLObjectType({
isTest: {
type: GraphQLBoolean,
description: 'Is this a test schema? Sure it is.',
resolve: () => {
return true;
},
resolve: () => true,
},
image: {
type: GraphQLString,
Expand Down