Created
July 19, 2019 06:50
-
-
Save alersenkevich/e2c0629fed2c56c70180fb66435d61fa to your computer and use it in GitHub Desktop.
eslint + typescript + react
This file contains hidden or 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
{ | |
"parser": "@typescript-eslint/parser", | |
"parserOptions": { | |
"ecmaFeatures": { "jsx": true }, | |
"ecmaVersion": 2018, | |
"sourceType": "module" | |
}, | |
"extends": [ | |
"airbnb", | |
"prettier", | |
"prettier/react", | |
"plugin:@typescript-eslint/recommended", | |
"prettier/@typescript-eslint" | |
], | |
"plugins": ["react", "prettier", "@typescript-eslint"], | |
"rules": { | |
"react/jsx-filename-extension": 0, | |
"react/prop-types": 0, | |
"prettier/prettier": [ | |
"error", | |
{ | |
"singleQuote": true, | |
"trailingComma": "all", | |
"arrowParens": "always" | |
} | |
], | |
"max-len": ["error", 140], | |
"@typescript-eslint/explicit-function-return-type": "off", | |
"@typescript-eslint/no-explicit-any": "off", | |
"no-underscore-dangle": "off" | |
}, | |
"env": {"browser": true}, | |
"settings": { | |
"import/resolver": { | |
"node": { | |
"extensions": [ | |
".js", | |
".jsx", | |
".ts", | |
".tsx" | |
] | |
} | |
} | |
} | |
} |
This file contains hidden or 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
Show hidden characters
{ | |
"include": ["/**/*"], | |
"compilerOptions": { | |
"module": "commonjs", | |
"target": "esnext", | |
"lib":["esnext"], | |
"types": ["node"], | |
"typeRoots": ["node_modules/@types"], | |
"sourceMap": true, | |
"outDir": "./build/", | |
"rootDir": "./src/" | |
}, | |
} |
This file contains hidden or 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
const path = require('path'); | |
const webpack = require('webpack'); | |
const UglifyJsPlugin = require('uglifyjs-webpack-plugin'); | |
module.exports = { | |
entry: './src/frontend/index.jsx', | |
output: { | |
path: path.resolve(__dirname, './assets'), | |
filename: 'bundle.js', | |
}, | |
devtool: 'inline-source-map', | |
resolve: { | |
modules: ['node_modules', path.resolve('src/frontend')], | |
extensions: ['.js', '.jsx', '.json'], | |
}, | |
module: { | |
rules: [ | |
{ | |
enforce: 'pre', | |
test: /\.jsx?$/, | |
exclude: [/node_modules/, /additional_modules/], | |
use: ['eslint-loader'], | |
}, | |
{ | |
test: /\.jsx?$/, | |
exclude: [/node_modules/, /additional_modules/], | |
use: { | |
loader: 'babel-loader', | |
query: { presets: ['react'] }, | |
}, | |
}, | |
], | |
}, | |
plugins: [ | |
// new HardSourceWebpackPlugin(), | |
new webpack.SourceMapDevToolPlugin(), | |
], | |
optimization: { | |
minimizer: [ | |
new UglifyJsPlugin({ | |
cache: true, | |
parallel: true, | |
uglifyOptions: { | |
compress: false, | |
ecma: 6, | |
mangle: true, | |
}, | |
sourceMap: true, | |
}), | |
], | |
}, | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment