-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ad3580e
commit fd8559d
Showing
24 changed files
with
32,087 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.eslintrc.js | ||
node_modules |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* eslint-env node */ | ||
|
||
const { node: restrictedImports } = require('@uniswap/eslint-config/restrictedImports') | ||
require('@uniswap/eslint-config/load') | ||
|
||
module.exports = { | ||
extends: ['@uniswap/eslint-config/react'], | ||
plugins: [], | ||
|
||
overrides: [ | ||
{ | ||
files: ['**/*'], | ||
rules: { | ||
'multiline-comment-style': ['error', 'separate-lines'], | ||
}, | ||
}, | ||
{ | ||
// Configuration/typings typically export objects/definitions that are used outside of the transpiled package | ||
// (eg not captured by the tsconfig). Because it's typical and not exceptional, this is turned off entirely. | ||
files: ['**/*.config.*', '**/*.d.ts'], | ||
rules: { | ||
'import/no-unused-modules': 'off', | ||
}, | ||
}, | ||
{ | ||
files: ['**/*.ts', '**/*.tsx'], | ||
rules: { | ||
'@typescript-eslint/no-restricted-imports': [ | ||
'error', | ||
restrictedImports, | ||
], | ||
'no-restricted-syntax': [ | ||
'error', | ||
{ | ||
selector: ':matches(ExportAllDeclaration)', | ||
message: 'Barrel exports bloat the bundle size by preventing tree-shaking.', | ||
}, | ||
], | ||
}, | ||
}, | ||
{ | ||
files: ['**/*.ts', '**/*.tsx'], | ||
rules: { | ||
'no-restricted-imports': ['error'], | ||
}, | ||
}, | ||
], | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
build | ||
node_modules |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"semi": false, | ||
"singleQuote": true, | ||
"printWidth": 120 | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* eslint-disable @typescript-eslint/no-var-requires */ | ||
/* eslint-env node */ | ||
const NodePolyfillPlugin = require('node-polyfill-webpack-plugin') | ||
|
||
const isProduction = process.env.NODE_ENV === 'production' | ||
|
||
const shouldLintOrTypeCheck = !isProduction | ||
|
||
module.exports = { | ||
eslint: { | ||
enable: shouldLintOrTypeCheck, | ||
pluginOptions(eslintConfig) { | ||
return Object.assign(eslintConfig, { | ||
cache: true, | ||
cacheLocation: 'node_modules/.cache/eslint/', | ||
}) | ||
}, | ||
}, | ||
typescript: { | ||
enableTypeChecking: shouldLintOrTypeCheck, | ||
}, | ||
webpack: { | ||
plugins: [ | ||
new NodePolyfillPlugin({ | ||
excludeAliases: ['console'], | ||
}), | ||
], | ||
configure: (webpackConfig) => { | ||
webpackConfig.resolve = Object.assign(webpackConfig.resolve, { | ||
fallback: { | ||
net: false, | ||
tls: false, | ||
fs: false, | ||
}, | ||
}) | ||
|
||
webpackConfig.optimization = Object.assign( | ||
webpackConfig.optimization, | ||
isProduction | ||
? { | ||
splitChunks: { | ||
// Cap the chunk size to 5MB. | ||
// react-scripts suggests a chunk size under 1MB after gzip, but we can only measure maxSize before gzip. | ||
// react-scripts also caps cacheable chunks at 5MB, which gzips to below 1MB, so we cap chunk size there. | ||
// See https://github.com/facebook/create-react-app/blob/d960b9e/packages/react-scripts/config/webpack.config.js#L713-L716. | ||
maxSize: 5 * 1024 * 1024, | ||
// Optimize over all chunks, instead of async chunks (the default), so that initial chunks are also optimized. | ||
chunks: 'all', | ||
}, | ||
} | ||
: {} | ||
) | ||
|
||
return webpackConfig | ||
}, | ||
}, | ||
} |
Oops, something went wrong.