Skip to content

Commit dde14ec

Browse files
authored
Add lint, format and type checks. Update code style and fix CI. (#392)
1 parent 6ee29d3 commit dde14ec

File tree

475 files changed

+7107
-4867
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

475 files changed

+7107
-4867
lines changed

.devcontainer/devcontainer.json

Lines changed: 51 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,53 @@
11
{
2-
"name": "Jupyter UI",
3-
"build": {
4-
"dockerfile": "Dockerfile",
5-
"context": "../",
6-
"target": "dev"
7-
},
8-
"remoteUser": "mambauser",
9-
"postStartCommand": "yarn install",
10-
"hostRequirements": {
11-
"memory": "2gb",
12-
"cpus": 2
13-
},
14-
"portsAttributes": {
15-
"8686": {
16-
"label": "Jupyter Server",
17-
"onAutoForward": "notify"
18-
},
19-
"3208": {
20-
"label": "Webpack Application",
21-
"onAutoForward": "notify"
22-
},
23-
"3000": {
24-
"label": "CRA, Docusaurus, Next.js... ",
25-
"onAutoForward": "notify"
26-
}
27-
},
28-
"customizations": {
29-
"vscode": {
30-
"settings": {
31-
"terminal.integrated.profiles.linux": {
32-
"bash": {
33-
"path": "/bin/bash"
34-
}
35-
},
36-
"python.defaultInterpreterPath": "/usr/local/bin/python",
37-
"python.languageServer": "Default",
38-
"pylinting.enabled": true,
39-
"pylinting.pylintEnabled": true,
40-
"autopep8.path": [
41-
"/usr/local/py-utils/bin/autopep8"
42-
],
43-
"autopep8.blackPath": "/usr/local/py-utils/bin/black",
44-
"autopep8.yapfPath": "/usr/local/py-utils/bin/yapf",
45-
"pylinting.banditPath": "/usr/local/py-utils/bin/bandit",
46-
"pylinting.flake8Path": "/usr/local/py-utils/bin/flake8",
47-
"pylinting.mypyPath": "/usr/local/py-utils/bin/mypy",
48-
"pylinting.pycodestylePath": "/usr/local/py-utils/bin/pycodestyle",
49-
"pylinting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle",
50-
"pylinting.pylintPath": "/usr/local/py-utils/bin/pylint"
51-
},
52-
"extensions": [
53-
"ms-python.python",
54-
"ms-python.vscode-pylance"
55-
]
56-
}
57-
}
2+
"name": "Jupyter UI",
3+
"build": {
4+
"dockerfile": "Dockerfile",
5+
"context": "../",
6+
"target": "dev"
7+
},
8+
"remoteUser": "mambauser",
9+
"postStartCommand": "yarn install",
10+
"hostRequirements": {
11+
"memory": "2gb",
12+
"cpus": 2
13+
},
14+
"portsAttributes": {
15+
"8686": {
16+
"label": "Jupyter Server",
17+
"onAutoForward": "notify"
18+
},
19+
"3208": {
20+
"label": "Webpack Application",
21+
"onAutoForward": "notify"
22+
},
23+
"3000": {
24+
"label": "CRA, Docusaurus, Next.js... ",
25+
"onAutoForward": "notify"
26+
}
27+
},
28+
"customizations": {
29+
"vscode": {
30+
"settings": {
31+
"terminal.integrated.profiles.linux": {
32+
"bash": {
33+
"path": "/bin/bash"
34+
}
35+
},
36+
"python.defaultInterpreterPath": "/usr/local/bin/python",
37+
"python.languageServer": "Default",
38+
"pylinting.enabled": true,
39+
"pylinting.pylintEnabled": true,
40+
"autopep8.path": ["/usr/local/py-utils/bin/autopep8"],
41+
"autopep8.blackPath": "/usr/local/py-utils/bin/black",
42+
"autopep8.yapfPath": "/usr/local/py-utils/bin/yapf",
43+
"pylinting.banditPath": "/usr/local/py-utils/bin/bandit",
44+
"pylinting.flake8Path": "/usr/local/py-utils/bin/flake8",
45+
"pylinting.mypyPath": "/usr/local/py-utils/bin/mypy",
46+
"pylinting.pycodestylePath": "/usr/local/py-utils/bin/pycodestyle",
47+
"pylinting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle",
48+
"pylinting.pylintPath": "/usr/local/py-utils/bin/pylint"
49+
},
50+
"extensions": ["ms-python.python", "ms-python.vscode-pylance"]
51+
}
52+
}
5853
}

.editorconfig

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# EditorConfig is awesome: https://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
# Unix-style newlines with a newline ending every file
7+
[*]
8+
charset = utf-8
9+
end_of_line = lf
10+
insert_final_newline = true
11+
trim_trailing_whitespace = true
12+
13+
# TypeScript, JavaScript, JSX, TSX files
14+
[*.{ts,tsx,js,jsx}]
15+
indent_style = space
16+
indent_size = 2
17+
18+
# JSON files
19+
[*.json]
20+
indent_style = space
21+
indent_size = 2
22+
23+
# YAML files
24+
[*.{yml,yaml}]
25+
indent_style = space
26+
indent_size = 2
27+
28+
# Markdown files
29+
[*.{md,mdx}]
30+
trim_trailing_whitespace = false
31+
32+
# Python files
33+
[*.py]
34+
indent_style = space
35+
indent_size = 4
36+
37+
# Makefile
38+
[Makefile]
39+
indent_style = tab
40+
41+
# Package files
42+
[package.json]
43+
indent_style = space
44+
indent_size = 2
45+
46+
# CSS files
47+
[*.css]
48+
indent_style = space
49+
indent_size = 2
50+
51+
# HTML files
52+
[*.html]
53+
indent_style = space
54+
indent_size = 2

.eslintrc.js

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
/*
2+
* Copyright (c) 2021-2023 Datalayer, Inc.
3+
*
4+
* MIT License
5+
*/
6+
7+
module.exports = {
8+
root: true,
9+
parser: '@typescript-eslint/parser',
10+
parserOptions: {
11+
ecmaVersion: 2020,
12+
sourceType: 'module',
13+
ecmaFeatures: {
14+
jsx: true,
15+
},
16+
},
17+
settings: {
18+
react: {
19+
version: 'detect',
20+
},
21+
},
22+
env: {
23+
browser: true,
24+
es2020: true,
25+
node: true,
26+
jest: true,
27+
},
28+
extends: [
29+
'eslint:recommended',
30+
'plugin:@typescript-eslint/recommended',
31+
'plugin:react/recommended',
32+
'plugin:react-hooks/recommended',
33+
'plugin:prettier/recommended', // This must be last
34+
],
35+
plugins: ['@typescript-eslint', 'react', 'react-hooks', 'prettier'],
36+
rules: {
37+
// TypeScript specific rules
38+
'@typescript-eslint/explicit-module-boundary-types': 'off',
39+
'@typescript-eslint/no-explicit-any': 'warn',
40+
'@typescript-eslint/no-unused-vars': [
41+
'warn',
42+
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
43+
],
44+
'@typescript-eslint/no-non-null-assertion': 'warn',
45+
46+
// React specific rules
47+
'react/react-in-jsx-scope': 'off', // Not needed with React 17+
48+
'react/prop-types': 'off', // We use TypeScript for type checking
49+
'react/display-name': 'off',
50+
'react/no-unescaped-entities': 'warn',
51+
52+
// General rules
53+
'no-console': ['warn', { allow: ['warn', 'error'] }],
54+
'no-debugger': 'warn',
55+
'prefer-const': 'warn',
56+
'no-var': 'error',
57+
58+
// Prettier integration
59+
'prettier/prettier': 'warn',
60+
},
61+
overrides: [
62+
{
63+
// Test files
64+
files: ['**/*.test.ts', '**/*.test.tsx', '**/*.spec.ts', '**/*.spec.tsx'],
65+
env: {
66+
jest: true,
67+
},
68+
},
69+
{
70+
// JavaScript files
71+
files: ['**/*.js', '**/*.jsx'],
72+
rules: {
73+
'@typescript-eslint/no-var-requires': 'off',
74+
},
75+
},
76+
{
77+
// Storybook files
78+
files: ['**/*.stories.tsx', '**/*.stories.ts'],
79+
rules: {
80+
'import/no-anonymous-default-export': 'off',
81+
},
82+
},
83+
],
84+
ignorePatterns: [
85+
'node_modules/',
86+
'dist/',
87+
'build/',
88+
'lib/',
89+
'*.min.js',
90+
'coverage/',
91+
'.next/',
92+
'storybook-static/',
93+
],
94+
};

0 commit comments

Comments
 (0)