Skip to content

Commit 146cda4

Browse files
jamesbhobbsdevin-ai-integration[bot]saltenaslArtmann
authored
chore: add lint-staged with pre-commit hooks for src/ directory (#38)
* chore: add lint-staged with pre-commit hooks for src/ directory - Upgrade husky from 8.0.3 to 9.1.7 - Add lint-staged 16.2.3 for automated code quality checks - Configure lint-staged to run eslint and prettier on src/**/*.{ts,tsx} - Update pre-commit hook to use lint-staged - Add post-checkout hook for automatic dependency installation - Add pre-push hook to prevent direct pushes to main branch This matches the setup in jupyterlab-deepnote for consistency. * fix: update package-lock.json for husky 9.1.7 and lint-staged 16.2.3 Update package-lock.json to match the package.json changes made in the previous commit. This resolves the npm ci failures in CI where the lock file was out of sync with package.json. All verification steps passed locally: - npm run lint ✓ - npm run format ✓ - npm run typecheck ✓ - npm run compile ✓ - npm test ✓ (1329 passing) * Update .husky/post-checkout Co-authored-by: Christoffer Artmann <Artgaard@gmail.com> * fix: package-lock.json * remove .eslintcache --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Lukas Šaltėnas <lukas.saltenas@gmail.com> Co-authored-by: Christoffer Artmann <Artgaard@gmail.com>
1 parent f5cec10 commit 146cda4

File tree

6 files changed

+786
-114
lines changed

6 files changed

+786
-114
lines changed

.gitignore

Lines changed: 56 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,75 @@
1+
__pycache__
2+
!build/
3+
!src/test/pythonEnvironments/**/*.*
4+
!yarn.lock
15
.DS_Store
6+
.eslintcache
7+
.github_token
28
.huskyrc.json
3-
dist
4-
out
9+
.nyc_output
10+
.pytest_cache
11+
.python-version
12+
.qlty/cache
13+
.qlty/logs
14+
.qlty/out
15+
.qlty/plugin_cachedir
16+
.qlty/results
17+
.vs/
18+
.vscode-test
19+
.vscode-test-web
520
*.exe
6-
log.log
7-
**/node_modules
21+
*.i18n.json
22+
*.nls.*.json
23+
*.noseids
824
*.pyc
925
*.vsix
26+
*.xlf
27+
**/.mypy_cache/**
28+
**/.venv*/
29+
**/.vscode test/**
30+
**/.vscode-smoke/**
31+
**/.vscode-test/**
1032
**/.vscode/.ropeproject/**
33+
**/*.esbuild.meta.json
34+
**/node_modules
1135
**/testFiles/**/.cache/**
12-
*.noseids
13-
.nyc_output
14-
.vscode-test
15-
__pycache__
16-
npm-debug.log
17-
**/.mypy_cache/**
18-
!yarn.lock
36+
# Compilation of less to css
37+
# Esbuild files
38+
# Qlty cache directories
39+
# translation files
40+
bin/**
1941
coverage/
2042
cucumber-report.json
21-
**/.vscode-test/**
22-
**/.vscode test/**
23-
**/.vscode-smoke/**
24-
**/.venv*/
25-
port.txt
26-
precommit.hook
27-
pythonFiles/lib/**
2843
debug_coverage*/**
29-
languageServer/**
44+
debug*.log
45+
debugpy*.log
46+
dist
47+
l10n/
3048
languageServer.*/**
31-
bin/**
49+
languageServer/**
50+
log.log
3251
logs/**
52+
nodeLanguageServer.*/**
53+
nodeLanguageServer/**
54+
npm-debug.log
3355
obj/**
34-
.pytest_cache
35-
temp
36-
tmp
37-
src/test/datascience/tmp/**
38-
src/test/datascience/temp/**
39-
.python-version
40-
.vs/
41-
test-results*.xml
42-
testresults.json
43-
telemetry.json
44-
xunit-test-results.xml
45-
!build/
46-
debug*.log
47-
debugpy*.log
56+
out
57+
port.txt
58+
precommit.hook
4859
pydevd*.log
49-
vscode.d.ts
50-
vscode.proposed.*.d.ts
51-
nodeLanguageServer/**
52-
nodeLanguageServer.*/**
60+
pythonFiles/lib/**
5361
src/test/datascience/.venv*
54-
!src/test/pythonEnvironments/**/*.*
55-
.vscode-test-web
56-
.github_token
57-
# translation files
58-
*.xlf
59-
*.nls.*.json
60-
*.i18n.json
61-
l10n/
62-
# Esbuild files
63-
**/*.esbuild.meta.json
64-
# Compilation of less to css
62+
src/test/datascience/temp/**
63+
src/test/datascience/tmp/**
6564
src/webviews/webview-side/interactive-common/variableExplorerGrid.css
6665
src/webviews/webview-side/interactive-common/variableExplorerGrid.css.map
6766
src/webviews/webview-side/react-common/seti/seti.css
6867
src/webviews/webview-side/react-common/seti/seti.css.map
69-
# Qlty cache directories
70-
.qlty/cache
71-
.qlty/logs
72-
.qlty/out
73-
.qlty/plugin_cachedir
74-
.qlty/results
68+
telemetry.json
69+
temp
70+
test-results*.xml
71+
testresults.json
72+
tmp
73+
vscode.d.ts
74+
vscode.proposed.*.d.ts
75+
xunit-test-results.xml

.husky/post-checkout

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npm ci

.husky/pre-commit

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1 @@
1-
#!/bin/sh
2-
if npm list prettier | grep -q prettier@ ; then
3-
echo husky - prettier is installed
4-
else
5-
echo husky - prettier is not installed, skipping format check
6-
exit 0
7-
fi
8-
9-
# run prettier on all .ts files that are in the commit
10-
changed=$(git diff --diff-filter=ACM --cached --name-only | grep .ts$ | tr '\n' ' ')
11-
12-
if [ -z "$changed" ]; then
13-
echo husky - No modified files to check
14-
exit 0
15-
fi
16-
17-
npx prettier $changed --check
1+
npm exec lint-staged

.husky/pre-push

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
branch_name="$(git symbolic-ref --short HEAD)"
2+
if [ "$branch_name" = "main" ]; then
3+
echo "Pushing directly to main is not allowed."
4+
exit 1
5+
fi

0 commit comments

Comments
 (0)