Skip to content

Commit

Permalink
migrate to eslint 9, use gatsby-plugin-root-import
Browse files Browse the repository at this point in the history
  • Loading branch information
ayan4m1 committed Sep 25, 2024
1 parent 4c87dc3 commit 486abf9
Show file tree
Hide file tree
Showing 7 changed files with 12,057 additions and 21,566 deletions.
37 changes: 0 additions & 37 deletions .eslintrc.js

This file was deleted.

55 changes: 55 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import js from '@eslint/js';
import globals from 'globals';
import reactPlugin from 'eslint-plugin-react';
import babelParser from '@babel/eslint-parser';
import importPlugin from 'eslint-plugin-import-x';
import reactHooksPlugin from 'eslint-plugin-react-hooks';
import prettierPlugin from 'eslint-plugin-prettier/recommended';

export default [
js.configs.recommended,
importPlugin.flatConfigs.recommended,
importPlugin.flatConfigs.react,
{
plugins: {
react: reactPlugin,
'react-hooks': reactHooksPlugin
},
languageOptions: {
globals: globals.browser,
parser: babelParser,
parserOptions: {
requireConfigFile: false,
babelOptions: {
presets: [['babel-preset-gatsby', { reactRuntime: 'automatic' }]]
}
}
},
rules: {
...reactPlugin.configs.recommended.rules,
...reactHooksPlugin.configs.recommended.rules,
'react/jsx-uses-react': 0,
'react/react-in-jsx-scope': 0
},
settings: {
react: {
version: 'detect'
},
'import-x/resolver': {
node: {
paths: ['./src/']
}
}
}
},
{
files: ['gatsby-*.js'],
languageOptions: {
globals: {
...globals.node,
...globals.browser
}
}
},
prettierPlugin
];
3 changes: 2 additions & 1 deletion gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ module.exports = {
'gatsby-plugin-sharp',
'gatsby-plugin-sharp-exif',
'gatsby-plugin-react-helmet',
'gatsby-transformer-sharp'
'gatsby-transformer-sharp',
'@ayan4m1/gatsby-plugin-root-import'
]
};
12 changes: 1 addition & 11 deletions gatsby-node.js
Original file line number Diff line number Diff line change
@@ -1,11 +1 @@
const { resolve } = require('path');

exports.createPages = async () => {};

exports.onCreateWebpackConfig = ({ actions }) => {
actions.setWebpackConfig({
resolve: {
modules: [resolve(__dirname, 'src'), 'node_modules']
}
});
};
// no-op
Loading

0 comments on commit 486abf9

Please sign in to comment.