Created
October 31, 2019 09:57
-
-
Save j138/63603a57cd414ba0d8cca57875509329 to your computer and use it in GitHub Desktop.
import/no-absolute-path 対応
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/.eslintrc.js b/.eslintrc.js | |
index 5594d79..84bc5b3 100644 | |
--- a/.eslintrc.js | |
+++ b/.eslintrc.js | |
@@ -8,13 +8,18 @@ module.exports = { | |
ecmascript: 6, | |
jsx: true, | |
}, | |
- extends: ['airbnb', 'prettier', 'prettier/react'], | |
+ extends: ['airbnb', 'prettier', 'prettier/react', 'plugin:import/errors', 'plugin:import/warnings'], | |
settings: { | |
react: { | |
createClass: 'createReactClass', | |
version: 'detect', | |
}, | |
'import/core-modules': ['styled-jsx/css'], | |
+ 'import/resolver': { | |
+ 'node': { | |
+ 'paths': ['.'] | |
+ }, | |
+ }, | |
}, | |
parser: 'babel-eslint', | |
plugins: ['react', 'react-hooks', 'prettier'], | |
diff --git a/next.config.js b/next.config.js | |
index bd98df1..d461392 100644 | |
--- a/next.config.js | |
+++ b/next.config.js | |
@@ -1,4 +1,5 @@ | |
const webpack = require('webpack'); | |
+const path = require('path'); | |
const withBundleAnalyzer = require('@next/bundle-analyzer')({ | |
enabled: process.env.ANALYZE === 'true', | |
}); | |
@@ -25,6 +26,13 @@ module.exports = withSass( | |
withSourceMaps({ | |
webpack(config) { | |
config.plugins.push(new webpack.ContextReplacementPlugin(/moment[/\\]locale$/, /ja/)); | |
+ config.resolve.alias.src = path.join(__dirname, 'src'); | |
return config; | |
}, | |
serverRuntimeConfig: { | |
diff --git a/pages/_app.js b/pages/_app.js | |
index a006c3f..4538e0e 100644 | |
--- a/pages/_app.js | |
+++ b/pages/_app.js | |
@@ -3,13 +3,13 @@ import Router from 'next/router'; | |
import moment from 'moment-timezone'; | |
import NProgress from 'nprogress'; | |
import Helmet from 'react-helmet'; | |
-import auth0 from '../src/lib/auth0'; | |
-import '../src/styles'; | |
-import { InjectStoreContext, initializeData } from '../src/stores'; | |
-import InjectThemeProvider from '../src/components/InjectThemeProvider'; | |
-import { appName, defaultTimeZone } from '../src/config'; | |
-import { parseCookie } from '../src/lib/cookie'; | |
-import * as gtag from '../src/lib/gtag'; | |
+import InjectThemeProvider from 'src/components/InjectThemeProvider'; | |
+import auth0 from 'src/lib/auth0'; | |
+import 'src/styles'; | |
+import { InjectStoreContext, initializeData } from 'src/stores'; | |
+import { appName, defaultTimeZone } from 'src/config'; | |
+import { parseCookie } from 'src/lib/cookie'; | |
+import * as gtag from 'src/lib/gtag'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment