-
Notifications
You must be signed in to change notification settings - Fork 266
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
Showing
4 changed files
with
149 additions
and
45 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 |
---|---|---|
@@ -1,42 +1,43 @@ | ||
module.exports = { | ||
parser: '@typescript-eslint/parser', // Specifies the ESLint parser | ||
extends: [ | ||
'airbnb', | ||
'plugin:@typescript-eslint/eslint-recommended', | ||
'plugin:@typescript-eslint/recommended', | ||
'prettier', | ||
'prettier/react', | ||
'prettier/@typescript-eslint', | ||
], | ||
parserOptions: { | ||
ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features | ||
sourceType: 'module', // Allows for the use of imports | ||
ecmaFeatures: { | ||
jsx: true, // Allows for the parsing of JSX | ||
}, | ||
}, | ||
rules: { | ||
'import/no-unresolved': 0, | ||
'no-console': ['error', { allow: ['warn', 'error'] }], | ||
'react/prop-types': 'off', | ||
'@typescript-eslint/explicit-function-return-type': 'off', | ||
'@typescript-eslint/no-explicit-any': 'error', | ||
'react/display-name': 'off', | ||
'react/jsx-filename-extension': [1, { extensions: ['.jsx', '.tsx', '.js', '.ts'] }], | ||
'react/jsx-props-no-spreading': 0, | ||
'operator-assignment': 0, | ||
'react/no-did-update-set-state': 0, | ||
'consistent-return': 0, | ||
'react/sort-comp': 0, | ||
'no-plusplus': 'off', // i++ | ||
radix: 'off', // parseInt Missing radix parameter | ||
'no-restricted-properties': 'off', // Math.pow(10, 2) === 10**2 | ||
'import/order': 0, | ||
'@typescript-eslint/explicit-member-accessibility': 0, | ||
'@typescript-eslint/no-non-null-assertion': 0, | ||
'no-param-reassign': 0, | ||
'@typescript-eslint/no-object-literal-type-assertion': 0, | ||
'no-empty-function': 'off', | ||
'@typescript-eslint/no-empty-function': 'off', | ||
parser: '@typescript-eslint/parser', // Specifies the ESLint parser | ||
extends: [ | ||
'airbnb', | ||
'plugin:@typescript-eslint/eslint-recommended', | ||
'plugin:@typescript-eslint/recommended', | ||
'prettier', | ||
'prettier/react', | ||
'prettier/@typescript-eslint', | ||
], | ||
parserOptions: { | ||
ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features | ||
sourceType: 'module', // Allows for the use of imports | ||
ecmaFeatures: { | ||
jsx: true, // Allows for the parsing of JSX | ||
}, | ||
}, | ||
rules: { | ||
'import/extensions': 0, | ||
'import/no-unresolved': 0, | ||
'no-console': ['error', { allow: ['warn', 'error'] }], | ||
'react/prop-types': 'off', | ||
'@typescript-eslint/explicit-function-return-type': 'off', | ||
'@typescript-eslint/no-explicit-any': 'error', | ||
'react/display-name': 'off', | ||
'react/jsx-filename-extension': [1, { extensions: ['.jsx', '.tsx', '.js', '.ts'] }], | ||
'react/jsx-props-no-spreading': 0, | ||
'operator-assignment': 0, | ||
'react/no-did-update-set-state': 0, | ||
'consistent-return': 0, | ||
'react/sort-comp': 0, | ||
'no-plusplus': 'off', // i++ | ||
radix: 'off', // parseInt Missing radix parameter | ||
'no-restricted-properties': 'off', // Math.pow(10, 2) === 10**2 | ||
'import/order': 0, | ||
'@typescript-eslint/explicit-member-accessibility': 0, | ||
'@typescript-eslint/no-non-null-assertion': 0, | ||
'no-param-reassign': 0, | ||
'@typescript-eslint/no-object-literal-type-assertion': 0, | ||
'no-empty-function': 'off', | ||
'@typescript-eslint/no-empty-function': 'off', | ||
}, | ||
}; |
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
export default { | ||
esm: { type: 'rollup', file: 'index', importLibToEs: true }, | ||
lessInRollupMode: {}, | ||
extractCSS: true, | ||
esm: { type: 'rollup', file: 'index', importLibToEs: true }, | ||
lessInRollupMode: {}, | ||
extractCSS: true, | ||
}; |
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
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,98 @@ | ||
/* eslint-disable @typescript-eslint/no-var-requires */ | ||
const path = require('path'); | ||
const MiniCssExtractPlugin = require('mini-css-extract-plugin'); | ||
// const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer'); | ||
|
||
module.exports = env => { | ||
return { | ||
entry: { | ||
bundle: './src/index.ts', | ||
}, | ||
mode: env.NODE_ENV, | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.js$/, | ||
use: ['source-map-loader'], | ||
enforce: 'pre', | ||
}, | ||
{ | ||
test: /\.(js|jsx)$/, | ||
exclude: /(node_modules|bower_components)/, | ||
loader: 'babel-loader', | ||
options: { | ||
presets: ['@babel/env', '@babel/preset-react'], | ||
plugins: [['@babel/plugin-proposal-class-properties', { loose: true }], ['react-hot-loader/babel']], | ||
}, | ||
}, | ||
{ | ||
test: /\.tsx?$/, | ||
loader: 'ts-loader', | ||
exclude: /node_modules/, | ||
options: { | ||
compilerOptions: { | ||
declaration: false, | ||
}, | ||
}, | ||
}, | ||
{ | ||
test: /\.css$/, | ||
use: [MiniCssExtractPlugin.loader, 'css-loader'], | ||
}, | ||
{ | ||
test: /\.(png|jpe?g|gif|svg)$/i, | ||
use: [ | ||
{ | ||
loader: 'file-loader', | ||
}, | ||
], | ||
}, | ||
{ | ||
test: /\.less$/, | ||
use: [ | ||
{ | ||
loader: MiniCssExtractPlugin.loader, | ||
}, | ||
{ | ||
loader: 'css-loader', // translates CSS into CommonJS | ||
}, | ||
{ | ||
loader: 'less-loader', // compiles Less to CSS | ||
options: { | ||
javascriptEnabled: true, | ||
}, | ||
}, | ||
], | ||
sideEffects: true, | ||
}, | ||
{ | ||
test: /\.(woff|woff2|eot|ttf|otf)$/, | ||
use: ['file-loader'], | ||
}, | ||
], | ||
}, | ||
|
||
resolve: { | ||
extensions: ['*', '.ts', '.tsx', '.js', '.jsx'], | ||
}, | ||
devtool: 'cheap-module-eval-source-map', | ||
output: { | ||
library: 'Graphin', | ||
libraryTarget: 'umd', | ||
path: path.resolve(__dirname, 'dist/'), | ||
publicPath: './', | ||
filename: 'graphin.min.js', | ||
}, | ||
plugins: [ | ||
new MiniCssExtractPlugin(), | ||
// new BundleAnalyzerPlugin() | ||
], | ||
externals: [ | ||
{ | ||
lodash: '_', | ||
react: 'window.React', | ||
'@antv/g6': 'G6', | ||
}, | ||
], | ||
}; | ||
}; |