Skip to content
This repository has been archived by the owner on Dec 10, 2021. It is now read-only.

refactor: merge core superset-ui packages #768

Merged
merged 1 commit into from
Sep 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
7 changes: 7 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
coverage/
node_modules/
public/
esm/
lib/
tmp/
dist/
69 changes: 69 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
const path = require('path');

module.exports = {
extends: [
'./node_modules/@airbnb/config-eslint/lib/presets/base.js',
'./node_modules/@airbnb/config-eslint/lib/presets/next.js',
'./node_modules/@airbnb/config-eslint/lib/presets/typescript.js',
'./node_modules/@airbnb/config-eslint/lib/presets/prettier.js',
'prettier/@typescript-eslint',
'prettier/unicorn',
],
parserOptions: {
project: path.join(__dirname, './tsconfig.eslint.json'),
},
rules: {
'arrow-parens': ['warn', 'as-needed'],
},
overrides: [
{
files: '**/*.d.ts',
rules: {
'max-classes-per-file': 0,
},
},
{
files: './packages/generator-superset/**/*.test.{js,jsx,ts,tsx}',
rules: {
'jest/expect-expect': 0,
},
},
{
files: '**/test/**/*',
rules: {
'import/no-extraneous-dependencies': 0,
'promise/param-names': 0,
'jest/require-to-throw-message': 0,
'jest/no-test-return-statement': 0,
'jest/no-expect-resolves': 0,
'@typescript-eslint/no-require-imports': 0,
'global-require': 0,
},
},
{
files: '*.{js,jsx,ts,tsx}',
rules: {
'import/extensions': 0,
'no-plusplus': 0,
'react/jsx-no-literals': 0,
'@typescript-eslint/no-unsafe-member-access': 0,
'@typescript-eslint/no-unsafe-call': 0,
'@typescript-eslint/no-explicit-any': [
'warn',
{
fixToUnknown: false,
},
],
},
},
{
files: ['./scripts/*', './*.config.js'],
rules: {
'no-console': 0,
},
env: {
node: true,
},
},
],
};
5 changes: 5 additions & 0 deletions .esprintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"paths": ["{packages,plugins}/*/{src,test,types}/**/*.{ts,tsx,js,jsx}"],
"ignores": ["**/node_modules/**/*"],
"port": 5004
}
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ jobs:
run: yarn install --frozen-lockfile
- name: Build packages
run: yarn build
- name: Run ESLint
run: yarn lint --quiet
- name: Run unit tests
run: yarn test

Expand Down
12 changes: 0 additions & 12 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,7 @@ _gh-pages/
*.min.js
test-changelog.md

# Configs (provided by Nimbus)
.babelrc
.eslintignore
.eslintrc.js
.flowconfig
.prettierignore
jest.config.js
prettier.config.js
tsconfig.eslint.json
tsconfig.json
tsconfig.options.json
*.tsbuildinfo
webpack.config.js

# Ignore npm lock files, always use yarn.lock instead
npm-shrinkwrap.json
Expand Down
14 changes: 14 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
coverage/
node_modules/
public/
esm/
lib/
tmp/
dist/
lerna.json
npm-shrinkwrap.json
package-lock.json
tsconfig.json
tsconfig.options.json
tsconfig.eslint.json
CHANGELOG.md
13 changes: 13 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"arrowParens": "avoid",
"bracketSpacing": true,
"jsxBracketSameLine": false,
"printWidth": 100,
"proseWrap": "always",
"requirePragma": false,
"semi": true,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "all",
"useTabs": false
}
11 changes: 0 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,8 @@ Current master: https://superset-ui.now.sh/
| Package | Version |
| ------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [@superset-ui/superset-ui](https://github.com/apache-superset/superset-ui/tree/master/packages/superset-ui-superset-ui) | [![Version](https://img.shields.io/npm/v/@superset-ui/superset-ui.svg?style=flat-square)](https://img.shields.io/npm/v/@superset-ui/superset-ui.svg?style=flat-square) |
| [@superset-ui/chart](https://github.com/apache-superset/superset-ui/tree/master/packages/superset-ui-chart) | [![Version](https://img.shields.io/npm/v/@superset-ui/chart.svg?style=flat-square)](https://img.shields.io/npm/v/@superset-ui/chart.svg?style=flat-square) |
| [@superset-ui/chart-composition](https://github.com/apache-superset/superset-ui/tree/master/packages/superset-ui-chart-composition) | [![Version](https://img.shields.io/npm/v/@superset-ui/chart-composition.svg?style=flat-square)](https://img.shields.io/npm/v/@superset-ui/chart-composition.svg?style=flat-square) |
| [@superset-ui/color](https://github.com/apache-superset/superset-ui/tree/master/packages/superset-ui-color) | [![Version](https://img.shields.io/npm/v/@superset-ui/color.svg?style=flat-square)](https://img.shields.io/npm/v/@superset-ui/color.svg?style=flat-square) |
| [@superset-ui/connection](https://github.com/apache-superset/superset-ui/tree/master/packages/superset-ui-connection) | [![Version](https://img.shields.io/npm/v/@superset-ui/connection.svg?style=flat-square)](https://img.shields.io/npm/v/@superset-ui/connection.svg?style=flat-square) |
| [@superset-ui/core](https://github.com/apache-superset/superset-ui/tree/master/packages/superset-ui-core) | [![Version](https://img.shields.io/npm/v/@superset-ui/core.svg?style=flat-square)](https://img.shields.io/npm/v/@superset-ui/core.svg?style=flat-square) |
| [@superset-ui/dimension](https://github.com/apache-superset/superset-ui/tree/master/packages/superset-ui-dimension) | [![Version](https://img.shields.io/npm/v/@superset-ui/dimension.svg?style=flat-square)](https://img.shields.io/npm/v/@superset-ui/dimension.svg?style=flat-square) |
| [@superset-ui/generator-superset](https://github.com/apache-superset/superset-ui/tree/master/packages/superset-ui-generator-superset) | [![Version](https://img.shields.io/npm/v/@superset-ui/generator-superset.svg?style=flat-square)](https://img.shields.io/npm/v/@superset-ui/generator-superset.svg?style=flat-square) |
| [@superset-ui/number-format](https://github.com/apache-superset/superset-ui/tree/master/packages/superset-ui-number-format) | [![Version](https://img.shields.io/npm/v/@superset-ui/number-format.svg?style=flat-square)](https://img.shields.io/npm/v/@superset-ui/number-format.svg?style=flat-square) |
| [@superset-ui/query](https://github.com/apache-superset/superset-ui/tree/master/packages/superset-ui-query) | [![Version](https://img.shields.io/npm/v/@superset-ui/query.svg?style=flat-square)](https://img.shields.io/npm/v/@superset-ui/query.svg?style=flat-square) |
| [@superset-ui/style](https://github.com/apache-superset/superset-ui/tree/master/packages/superset-ui-style) | [![Version](https://img.shields.io/npm/v/@superset-ui/style.svg?style=flat-square)](https://img.shields.io/npm/v/@superset-ui/style.svg?style=flat-square) |
| [@superset-ui/time-format](https://github.com/apache-superset/superset-ui/tree/master/packages/superset-ui-time-format) | [![Version](https://img.shields.io/npm/v/@superset-ui/time-format.svg?style=flat-square)](https://img.shields.io/npm/v/@superset-ui/time-format.svg?style=flat-square) |
| [@superset-ui/translation](https://github.com/apache-superset/superset-ui/tree/master/packages/superset-ui-translation) | [![Version](https://img.shields.io/npm/v/@superset-ui/translation.svg?style=flat-square)](https://img.shields.io/npm/v/@superset-ui/translation.svg?style=flat-square) |

### Chart plugin packages

Expand Down Expand Up @@ -65,7 +55,6 @@ packages are extracted with minimal changes (almost as-is). They also depend on
| [@superset-ui/legacy-plugin-chart-sankey-loop](https://github.com/apache-superset/superset-ui/tree/master/plugins/legacy-plugin-chart-sankey-loop) | [![Version](https://img.shields.io/npm/v/@superset-ui/legacy-plugin-chart-sankey-loop.svg?style=flat-square)](https://img.shields.io/npm/v/@superset-ui/legacy-plugin-chart-sankey-loop.svg?style=flat-square) |
| [@superset-ui/legacy-plugin-chart-sunburst](https://github.com/apache-superset/superset-ui/tree/master/plugins/legacy-plugin-chart-sunburst) | [![Version](https://img.shields.io/npm/v/@superset-ui/legacy-plugin-chart-sunburst.svg?style=flat-square)](https://img.shields.io/npm/v/@superset-ui/legacy-plugin-chart-sunburst.svg?style=flat-square) |
| [@superset-ui/legacy-plugin-chart-treemap](https://github.com/apache-superset/superset-ui/tree/master/plugins/legacy-plugin-chart-treemap) | [![Version](https://img.shields.io/npm/v/@superset-ui/legacy-plugin-chart-treemap.svg?style=flat-square)](https://img.shields.io/npm/v/@superset-ui/legacy-plugin-chart-treemap.svg?style=flat-square) |
| [@superset-ui/legacy-plugin-chart-word-cloud](https://github.com/apache-superset/superset-ui/tree/master/plugins/legacy-plugin-chart-word-cloud) | [![Version](https://img.shields.io/npm/v/@superset-ui/legacy-plugin-chart-word-cloud.svg?style=flat-square)](https://img.shields.io/npm/v/@superset-ui/legacy-plugin-chart-word-cloud.svg?style=flat-square) |
| [@superset-ui/legacy-plugin-chart-world-map](https://github.com/apache-superset/superset-ui/tree/master/plugins/legacy-plugin-chart-world-map) | [![Version](https://img.shields.io/npm/v/@superset-ui/legacy-plugin-chart-world-map.svg?style=flat-square)](https://img.shields.io/npm/v/@superset-ui/legacy-plugin-chart-world-map.svg?style=flat-square) |

`@superset-ui/plugin-*` packages are newer and higher quality in general. A key difference that they
Expand Down
3 changes: 1 addition & 2 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// eslint-disable-next-line no-undef, import/no-extraneous-dependencies
const { getConfig } = require('@airbnb/config-babel');

const config = getConfig({
library: true,
react: true,
next: true,
esm: process.env.BABEL_OUTPUT === 'esm',
node: process.env.NODE_ENV === 'test',
typescript: true,
env: {
Expand All @@ -16,5 +16,4 @@ const config = getConfig({
config.ignore = config.ignore.filter(item => item !== 'node_modules/');
config.ignore.push('node_modules/(?!(vega-lite|lodash-es))');

// eslint-disable-next-line no-undef
module.exports = config;
8 changes: 5 additions & 3 deletions docs/debugging.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
## Activate plugins for local development

1. First, make sure you have run `yarn` and `yarn build` in `superset-ui` or your own plugin repo.
2. Go to [sueprset-frontend](https://github.com/apache/incubator-superset/tree/master/superset-frontend),
2. Go to
[superset-frontend](https://github.com/apache/incubator-superset/tree/master/superset-frontend),
use `npm link` to create a symlink of the plugin source code in `node_modules`:

```sh
Expand All @@ -12,13 +13,14 @@
npm link ../../superset-ui/plugins/plugin-chart-word-cloud
```

3. Start developing with webpack dev server:
3. Start developing with webpack dev server:

```sh
npm run dev-server
```

The dev server will automatically build from the source code under `path/to/your-plugin/src` and watch the changes.
The dev server will automatically build from the source code under `path/to/your-plugin/src` and
watch the changes.

## Deactivate plugins

Expand Down
4 changes: 3 additions & 1 deletion docs/storybook.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ yarn build
yarn storybook
```

The Storybook will [automatically build from the source code](https://github.com/apache-superset/superset-ui/blob/master/packages/superset-ui-demo/.storybook/main.js#L49-L58) when package names start with `@superset-ui/`.
The Storybook will
[automatically build from the source code](https://github.com/apache-superset/superset-ui/blob/master/packages/superset-ui-demo/.storybook/main.js#L49-L58)
when package names start with `@superset-ui/`.
83 changes: 83 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
module.exports = {
"bail": false,
"collectCoverageFrom": [
"**/src/**/*.{ts,tsx,js,jsx}",
"**/test/**/*.{ts,tsx,js,jsx}"
],
"coverageDirectory": "./coverage",
"coveragePathIgnorePatterns": [
"coverage/",
"node_modules/",
"public/",
"esm/",
"lib/",
"tmp/",
"dist/"
],
"coverageReporters": [
"lcov",
"json-summary",
"html"
],
"coverageThreshold": {
"global": {
"branches": 0,
"functions": 0,
"lines": 0,
"statements": 0
}
},
"globals": {
"__DEV__": true,
"caches": true
},
"moduleFileExtensions": [
"mock.js",
"ts",
"tsx",
"js",
"jsx",
"json",
"node"
],
"moduleNameMapper": {
"^.+\\.(ttf|eot|otf|svg|woff|woff2|mp3|png|jpg|jpeg|gif|ico)$": "<rootDir>/node_modules/@airbnb/config-jest/mocks/file.js",
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/__mocks__/fileMock.js",
"\\.(css|less)$": "identity-obj-proxy"
},
"roots": [
"<rootDir>/packages",
"<rootDir>/plugins"
],
"setupFiles": [
"<rootDir>/node_modules/@airbnb/config-jest/setup/shims.js",
"<rootDir>/node_modules/@airbnb/config-jest/setup/console.js",
"<rootDir>/node_modules/@airbnb/config-jest/setup/dom.js"
],
"setupFilesAfterEnv": [
"<rootDir>/node_modules/@airbnb/config-jest/bootstrap/react.js",
"<rootDir>/node_modules/@airbnb/config-jest/bootstrap/consumer.js",
"@airbnb/config-jest/enzyme"
],
"testEnvironment": "jsdom",
"testURL": "http://localhost",
"timers": "real",
"verbose": false,
"transformIgnorePatterns": [
"node_modules/(?!(vega-lite|lodash-es))"
],
"testPathIgnorePatterns": [
"packages/generator-superset/generators"
],
"projects": [
"<rootDir>",
{
"displayName": "node",
"rootDir": "<rootDir>/packages/generator-superset",
"testMatch": [
"<rootDir>/test/**/?(*.)+(spec|test).{js,jsx,ts,tsx}"
],
"testEnvironment": "node"
}
]
};
Loading