Skip to content

Instantly share code, notes, and snippets.

@alersenkevich
Created July 19, 2019 06:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alersenkevich/e2c0629fed2c56c70180fb66435d61fa to your computer and use it in GitHub Desktop.
Save alersenkevich/e2c0629fed2c56c70180fb66435d61fa to your computer and use it in GitHub Desktop.
eslint + typescript + react
{
"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"
]
}
}
}
}
{
"include": ["/**/*"],
"compilerOptions": {
"module": "commonjs",
"target": "esnext",
"lib":["esnext"],
"types": ["node"],
"typeRoots": ["node_modules/@types"],
"sourceMap": true,
"outDir": "./build/",
"rootDir": "./src/"
},
}
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