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

Local ESlint configuration doesn't overwrite Gatsby ESlint configuration #31083

Closed
marceleq27 opened this issue Apr 28, 2021 · 3 comments · Fixed by #31087
Closed

Local ESlint configuration doesn't overwrite Gatsby ESlint configuration #31083

marceleq27 opened this issue Apr 28, 2021 · 3 comments · Fixed by #31087
Labels
type: documentation An issue or pull request for improving or updating Gatsby's documentation

Comments

@marceleq27
Copy link
Contributor

Description

Hi, I've upgraded my website to Gatsby v3, and after running 'gatsby develop' Gatsby showing a lot of warnings in CLI (mainly one ESlint rule => limited-exports-page-templates). But I have my personal .eslintrc in project.

Is this article still up-to-date? (Especially 'Disabling ESLint' paragraph) => https://www.gatsbyjs.com/docs/how-to/custom-configuration/eslint/

Expected result

No warnings.

Actual result

Example warning:

462:1 warning
In page templates only a default export of a valid React component and the named export of a page
query is allowed. All other named exports will cause Fast Refresh to not preserve local component state and do a full refresh.
Please move your other named exports to another file. Also make sure that you only export page queries that use the "graphql" tag from "gatsby".
limited-exports-page-templates

Environment

System:
OS: Linux 5.8 Ubuntu 20.04.2 LTS (Focal Fossa)
CPU: (16) x64 Intel(R) Core(TM) i7-10700K CPU @ 3.80GHz
Shell: 5.0.17 - /bin/bash
Binaries:
Node: 14.16.0 - ~/.nvm/versions/node/v14.16.0/bin/node
npm: 7.11.1 - ~/.nvm/versions/node/v14.16.0/bin/npm
Browsers:
Chrome: 90.0.4430.85
Firefox: 88.0
npmPackages:
gatsby: ^3.1.1 => 3.4.0
gatsby-cli: ^3.1.0 => 3.4.0
gatsby-link: ^3.1.0 => 3.4.0
gatsby-plugin-algolia: ^0.19.0 => 0.19.0
gatsby-plugin-anchor-links: ^1.2.1 => 1.2.1
gatsby-plugin-google-analytics: ^3.1.0 => 3.4.0
gatsby-plugin-google-tagmanager: ^3.1.0 => 3.4.0
gatsby-plugin-html-attributes: ^1.0.5 => 1.0.5
gatsby-plugin-image: ^1.1.1 => 1.4.0
gatsby-plugin-mailchimp: ^5.2.2 => 5.2.2
gatsby-plugin-manifest: ^3.1.0 => 3.4.0
gatsby-plugin-netlify: ^3.1.0 => 3.4.0
gatsby-plugin-offline: ^4.1.0 => 4.4.0
gatsby-plugin-react-helmet: ^4.1.0 => 4.4.0
gatsby-plugin-react-svg: ^3.0.0 => 3.0.1
gatsby-plugin-remove-serviceworker: ^1.0.0 => 1.0.0
gatsby-plugin-root-import: ^2.0.6 => 2.0.6
gatsby-plugin-sass: ^4.1.0 => 4.4.0
gatsby-plugin-sharp: ^3.1.1 => 3.4.0
gatsby-plugin-sitemap: ^3.1.0 => 3.3.0
gatsby-plugin-styled-components: ^4.1.0 => 4.4.0
gatsby-plugin-svgr: ^3.0.0-beta.0 => 3.0.0-beta.0
gatsby-plugin-webpack-bundle-analyser-v2: ^1.1.21 => 1.1.22
gatsby-remark-images: ^5.0.0 => 5.1.0
gatsby-source-filesystem: ^3.1.0 => 3.4.0
gatsby-transformer-javascript-frontmatter: ^3.1.0 => 3.4.0
gatsby-transformer-remark: ^4.0.0 => 4.1.0
gatsby-transformer-sharp: ^3.1.0 => 3.4.0
npmGlobalPackages:
gatsby-cli: 3.3.0

@marceleq27 marceleq27 added the type: bug An issue or pull request relating to a bug in Gatsby label Apr 28, 2021
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Apr 28, 2021
@LekoArts LekoArts added type: documentation An issue or pull request for improving or updating Gatsby's documentation and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer type: bug An issue or pull request relating to a bug in Gatsby labels Apr 28, 2021
@LekoArts
Copy link
Contributor

Hi, thanks for the issue! We missed updating the page as the behavior you're describing is working as intended, we only forgot to update the page.

Both rules are required and can't be overwritten/disabled with a custom configuration:

// Custom ESLint rules from Gatsby
"no-anonymous-exports-page-templates": `warn`,
"limited-exports-page-templates": `warn`,

I'll put up a PR updating the doc

@marceleq27
Copy link
Contributor Author

Awesome, thanks for the clarification :) Have a great day!

@jthanio
Copy link

jthanio commented Jan 26, 2023

@LekoArts Hi there, sorry replying to an old issue, but this is all I could find in the search for those custom ESLint rules.

Is there a way to add those rules to our own ESLint configuration? Without a plugin, attempting to add the rules gives an error that the rule could not be found, even when following the guide for gatsby-plugin-eslint. It would be great to have the custom lint rules used without needing to run the dev server first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: documentation An issue or pull request for improving or updating Gatsby's documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants