Skip to content

Commit

Permalink
chore: optimize project configs (#5299)
Browse files Browse the repository at this point in the history
* chore: optimize project configs
  • Loading branch information
Aarebecca authored Dec 28, 2023
1 parent dbfa806 commit cb7a763
Show file tree
Hide file tree
Showing 318 changed files with 3,973 additions and 10,860 deletions.
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
dist
es
lib
node_modules
56 changes: 56 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
module.exports = {
root: true,
env: {
browser: true,
es2021: true,
node: true,
commonjs: true,
jest: true,
},
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'plugin:jsdoc/recommended-error'],
overrides: [
{
env: {
node: true,
},
files: ['.eslintrc.{js,cjs}'],
parserOptions: {
sourceType: 'script',
},
},
],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
},
plugins: ['@typescript-eslint', 'jsdoc'],
rules: {
// indent: ['error', 2, { SwitchCase: 1 }],
'linebreak-style': ['error', 'unix'],
quotes: ['error', 'single', { allowTemplateLiterals: true, avoidEscape: true }],
semi: ['error', 'always'],

'jsdoc/require-param-type': 0,
'@typescript-eslint/no-this-alias': 'off',

// TODO: rules below will be set to 2 in the future
'jsdoc/require-jsdoc': 1,
'jsdoc/check-access': 1,
'jsdoc/check-tag-names': 1,
'jsdoc/require-description': 1,
'jsdoc/require-param': 1,
'jsdoc/check-param-names': 1,
'jsdoc/require-param-description': 1,
'jsdoc/require-returns': 1,
'jsdoc/require-returns-type': 0,
'jsdoc/require-returns-description': 1,

'@typescript-eslint/no-unused-vars': 1,

// TODO: rules below are not recommended, and will be removed in the future
'@typescript-eslint/no-explicit-any': 1,
'@typescript-eslint/ban-types': 1,
'@typescript-eslint/ban-ts-comment': 1,
},
};
11 changes: 1 addition & 10 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,4 @@ esm
coverage

# Bundle visualizer
stats.html

# Snapshots error images
packages/g6/tests/integration/snapshots/**/*-actual.*
packages/g6/tests/integration/snapshots/**/*-diff.*

# Website cache byb dumi
site/.dumi/tmp
site/.dumi/tmp-production

stats.html
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
dist
es
lib
node_modules
11 changes: 0 additions & 11 deletions .prettierrc

This file was deleted.

3 changes: 1 addition & 2 deletions packages/react-node/.prettierrc.js → .prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
module.exports = {
pluginSearchDirs: false,
plugins: [
require.resolve('prettier-plugin-organize-imports'),
require.resolve('prettier-plugin-packagejson'),
],
printWidth: 80,
printWidth: 120,
proseWrap: 'never',
singleQuote: true,
trailingComma: 'all',
Expand Down
52 changes: 37 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "g6",
"private": true,
"repository": "https://github.com/antvis/G6.git",
"scripts": {
"postinstall": "husky install",
"prepare": "husky install",
Expand All @@ -10,25 +11,46 @@
"build:react-node": "cd ./packages/react-node && npm run build",
"build:site": "cd ./packages/site && npm run build"
},
"devDependencies": {
"@commitlint/cli": "^17.8.1",
"@commitlint/config-conventional": "^17.8.1",
"husky": "^8.0.3",
"lint-staged": "^10.5.4",
"npm-run-all": "^4.1.5",
"prettier": "^2.8.8"
"commitlint": {
"extends": [
"@commitlint/config-conventional"
]
},
"lint-staged": {
"*.{ts,tsx}": [
"eslint --fix",
"prettier --write",
"git add"
"prettier --write"
]
},
"pnpm": {
"overrides": {
"prettier": "^2.8.8"
}
},
"repository": "https://github.com/antvis/G6.git"
"devDependencies": {
"@commitlint/cli": "^18.4.3",
"@commitlint/config-conventional": "^18.4.3",
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-terser": "^0.4.4",
"@rollup/plugin-typescript": "^11.1.5",
"@types/jest": "^29.5.11",
"@types/jsdom": "^21.1.6",
"@types/node": "^20.10.5",
"@typescript-eslint/eslint-plugin": "^6.15.0",
"@typescript-eslint/parser": "^6.15.0",
"eslint": "^8.56.0",
"eslint-plugin-jsdoc": "^46.9.1",
"husky": "^8.0.3",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"jsdom": "^23.0.1",
"limit-size": "^0.1.4",
"lint-staged": "^15.2.0",
"npm-run-all": "^4.1.5",
"prettier": "^3.1.1",
"prettier-plugin-organize-imports": "^3.2.4",
"prettier-plugin-packagejson": "^2.4.7",
"rimraf": "^5.0.5",
"rollup": "^4.9.1",
"rollup-plugin-polyfill-node": "^0.13.0",
"rollup-plugin-visualizer": "^5.11.0",
"ts-jest": "^29.1.1",
"typescript": "^5.3.3"
}
}
6 changes: 0 additions & 6 deletions packages/g6-plugin-map-view/.eslintignore

This file was deleted.

40 changes: 0 additions & 40 deletions packages/g6-plugin-map-view/.eslintrc

This file was deleted.

11 changes: 0 additions & 11 deletions packages/g6-plugin-map-view/.prettierrc

This file was deleted.

47 changes: 8 additions & 39 deletions packages/g6-plugin-map-view/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,55 +26,27 @@
"dist"
],
"scripts": {
"start": "rimraf ./lib && tsc --module commonjs --outDir lib --watch",
"build:umd": "rimraf ./dist && rollup -c && npm run size",
"build": "run-p build:*",
"build:cjs": "rimraf ./lib && tsc --module commonjs --outDir lib",
"build:esm": "rimraf ./esm && tsc --module ESNext --outDir esm",
"build": "run-p build:*",
"build:umd": "rimraf ./dist && rollup -c && npm run size",
"bundle-vis": "cross-env BUNDLE_VIS=1 run-p build:umd",
"prepublishOnly": "npm run ci",
"ci": "run-s lint build",
"clean": "rimraf es lib",
"clear:doc": "rimraf ../site/docs/_apis",
"doc": "npm run clear:doc && typedoc",
"lint": "eslint ./src --quiet && prettier ./src --check",
"size": "limit-size"
"prepublishOnly": "npm run ci",
"size": "limit-size",
"start": "rimraf ./lib && tsc --module commonjs --outDir lib --watch"
},
"dependencies": {
"@antv/dom-util": "^2.0.4",
"@antv/l7": "^2.18.3",
"@antv/l7-maps": "^2.18.3",
"@antv/util": "~2.0.5"
},
"devDependencies": {
"@rollup/plugin-terser": "^0.4.3",
"@types/gl": "6.0.2",
"@types/jsdom": "^21.1.1",
"@types/node": "13.11.1",
"@types/pixelmatch": "^5.2.4",
"@types/pngjs": "^6.0.1",
"@types/xmlserializer": "^0.6.3",
"@typescript-eslint/eslint-plugin": "^6.5.0",
"@typescript-eslint/parser": "^6.5.0",
"@umijs/fabric": "^2.0.0",
"babel-loader": "^8.0.6",
"eslint": "^8.48.0",
"eslint-plugin-import": "^2.28.1",
"father": "^2.29.1",
"gl": "^6.0.2",
"jsdom": "^19.0.0",
"limit-size": "^0.1.4",
"npm-run-all": "^4.1.5",
"prettier": "^3.0.3",
"rimraf": "^3.0.0",
"rollup": "^2.79.1",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-polyfill-node": "^0.8.0",
"rollup-plugin-typescript": "^1.0.1",
"rollup-plugin-visualizer": "^5.6.0",
"tslib": "^2.5.0",
"typedoc": "^0.25.0",
"typescript": "5.1.6"
"peerDependencies": {
"@antv/g6": "^5.0.0-beta.28"
},
"limit-size": [
{
Expand All @@ -86,8 +58,5 @@
"path": "dist/g6-plugin-map-view.min.js",
"limit": "3 Mb"
}
],
"peerDependencies": {
"@antv/g6": "^5.0.0-beta.28"
}
]
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import terser from '@rollup/plugin-terser';
import resolve from 'rollup-plugin-node-resolve';
import typescript from 'rollup-plugin-typescript';
import commonjs from '@rollup/plugin-commonjs';
import resolve from '@rollup/plugin-node-resolve';
import terser from '@rollup/plugin-terser';
import typescript from '@rollup/plugin-typescript';
import nodePolyfills from 'rollup-plugin-polyfill-node';
import { visualizer } from 'rollup-plugin-visualizer';

const isBundleVis = !!process.env.BUNDLE_VIS;

module.exports = [
export default [
{
input: 'src/index.ts',
output: {
Expand All @@ -16,13 +16,6 @@ module.exports = [
format: 'umd',
sourcemap: false,
},
plugins: [
nodePolyfills(),
resolve(),
commonjs(),
typescript(),
terser(),
...(isBundleVis ? [visualizer()] : []),
],
plugins: [nodePolyfills(), resolve(), commonjs(), typescript(), terser(), ...(isBundleVis ? [visualizer()] : [])],
},
];
Loading

0 comments on commit cb7a763

Please sign in to comment.