Gathering detailed insights and metrics for gatsby-plugin-eslint
Gathering detailed insights and metrics for gatsby-plugin-eslint
Gathering detailed insights and metrics for gatsby-plugin-eslint
Gathering detailed insights and metrics for gatsby-plugin-eslint
npm install gatsby-plugin-eslint
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
13 Stars
59 Commits
14 Forks
3 Watching
4 Branches
6 Contributors
Updated on 19 Mar 2024
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
-3.1%
3,149
Compared to previous day
Last week
2.9%
19,002
Compared to previous week
Last month
12%
82,039
Compared to previous month
Last year
-25.4%
1,102,628
Compared to previous year
1
3
Now working with Gatsby V3
Replaces Gatsby's ESLint Webpack configs, giving you full control to customize linting with the rules and developer experience you specifically need to maintain code quality.
This will COMPLETELY OVERWRITE any ESLint Webpack Plugins that Gatsby uses. The installation instructions will help you reactivate the two required rules as of writing:
npm install --save-dev gatsby-plugin-eslint eslint eslint-webpack-plugin
or
yarn add --dev gatsby-plugin-eslint eslint eslint-webpack-plugin
'develop'
stage. Add other Webpack Config Stages into stages
array to enable linting during other Gatsby stages (eg. build-javascript
).js
, .jsx
, .ts
, and .tsx
files.node_modules
, bower_components
, .cache
, and public
folders from lintingeslint-webpack-plugin
option defaultsCreate .eslintrc
file in project root.
1// .eslintrc 2 3// Gatsby's required rules 4{ 5 "rules": { 6 "no-anonymous-exports-page-templates": "warn", 7 "limited-exports-page-templates": "warn" 8 } 9}
Add plugin into gatsby-config.js
1// gatsby-config.js 2 3const path = require("path"); 4// Get paths of Gatsby's required rules, which as of writing is located at: 5// https://github.com/gatsbyjs/gatsby/tree/fbfe3f63dec23d279a27b54b4057dd611dce74bb/packages/ 6// gatsby/src/utils/eslint-rules 7const gatsbyRequiredRules = path.join( 8 process.cwd(), 9 "node_modules", 10 "gatsby", 11 "dist", 12 "utils", 13 "eslint-rules" 14); 15 16module.exports = { 17 plugins: [ 18 // ...other plugins 19 { 20 resolve: "gatsby-plugin-eslint", 21 options: { 22 // Gatsby required rules directory 23 rulePaths: [gatsbyRequiredRules], 24 // Default settings that may be omitted or customized 25 stages: ["develop"], 26 extensions: ["js", "jsx", "ts", "tsx"], 27 exclude: ["node_modules", "bower_components", ".cache", "public"], 28 // Any additional eslint-webpack-plugin options below 29 // ... 30 }, 31 }, 32 ], 33};
Additionally as of writing, Gatsby's default ESLint config may be copied over if you would still like to take advavntage of those rules.
Mix and match your own ESLint plugins and rules depending on the React/Javascript/Typescript patterns you want to enforce. Here are three ways you can get started:
eslint-plugin-react
Follow eslint-plugin-react
plugin installation procedures:
npm install --save-dev eslint-plugin-react babel-eslint
or
yarn add --dev eslint-plugin-react babel-eslint
Add .eslintrc
file to project root:
1{ 2 "parser": "babel-eslint", // uses babel-eslint transforms 3 "settings": { 4 "react": { 5 "version": "detect" // detect react version 6 } 7 }, 8 "env": { 9 "node": true // defines things like process.env when generating through node 10 }, 11 "extends": [ 12 "eslint:recommended", // use recommended configs 13 "plugin:react/recommended" 14 ], 15 "rules": { 16 "no-anonymous-exports-page-templates": "warn", 17 "limited-exports-page-templates": "warn" 18 } 19}
eslint-config-airbnb
Follow eslint-config-airbnb
plugin installation procedures. If npm 5+ this command works for npm
and yarn
npx install-peerdeps --dev eslint-config-airbnb
Add .eslintrc
file to project root:
1{ 2 "extends": "airbnb", 3 "rules": { 4 "no-anonymous-exports-page-templates": "warn", 5 "limited-exports-page-templates": "warn" 6 } 7}
Follow @typescript-eslint/eslint-plugin
plugin installation procedures:
npm install --save-dev typescript @typescript-eslint/parser @typescript-eslint/eslint-plugin
or
yarn add --dev typescript @typescript-eslint/parser @typescript-eslint/eslint-plugin
Add .eslintrc
file to project root:
1{ 2 "extends": [ 3 "eslint:recommended", 4 "plugin:@typescript-eslint/recommended", 5 ], 6 "rules": { 7 "no-anonymous-exports-page-templates": "warn", 8 "limited-exports-page-templates": "warn" 9 } 10}
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 3/13 approved changesets -- score normalized to 2
Reason
8 existing vulnerabilities detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More