Skip to content

Commit 469b8e6

Browse files
astitv-shandrii-i
andauthored
Enforce path imports for mui icons, Migrate to newer eslint (v8) (#572)
* Enforce path imports for mui icons, migrate to newer eslint * update snapshots * Fix: eslint errors and warnings * set a no-op filter if extraction filter is supported (Python 3.12+) --------- Co-authored-by: Andrii Ieroshenko <[email protected]>
1 parent 14c4451 commit 469b8e6

File tree

12 files changed

+600
-358
lines changed

12 files changed

+600
-358
lines changed

.eslintrc.js

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ module.exports = {
1010
project: 'tsconfig.json',
1111
sourceType: 'module'
1212
},
13-
plugins: ['@typescript-eslint'],
13+
plugins: ['@stylistic', '@typescript-eslint'],
1414
rules: {
1515
'@typescript-eslint/naming-convention': [
1616
'error',
@@ -27,13 +27,32 @@ module.exports = {
2727
'@typescript-eslint/no-explicit-any': 'off',
2828
'@typescript-eslint/no-namespace': 'off',
2929
'@typescript-eslint/no-use-before-define': 'off',
30-
'@typescript-eslint/quotes': [
30+
'@stylistic/quotes': [
3131
'error',
3232
'single',
3333
{ avoidEscape: true, allowTemplateLiterals: false }
3434
],
3535
curly: ['error', 'all'],
3636
eqeqeq: 'error',
37+
'no-restricted-imports': [
38+
'error',
39+
{
40+
paths: [
41+
{
42+
name: '@mui/icons-material',
43+
44+
message:
45+
"Please import icons using path imports, e.g. `import AddIcon from '@mui/icons-material/Add'`"
46+
}
47+
],
48+
patterns: [
49+
{
50+
group: ['@mui/*/*/*'],
51+
message: '3rd level imports in mui are considered private'
52+
}
53+
]
54+
}
55+
],
3756
'prefer-arrow-callback': 'error'
3857
}
3958
};

jupyter_scheduler/job_files_manager.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ def download_tar(self, archive_format: str = "tar"):
7575

7676
with fsspec.open(archive_filepath) as f:
7777
with tarfile.open(fileobj=f, mode=read_mode) as tar:
78+
# if extraction filter is supported (Python 3.12+), set a no-op filter
79+
if hasattr(tar, "extraction_filter"):
80+
tar.extraction_filter = lambda member, path: member
81+
7882
tar.extractall(self.output_dir)
7983

8084
def download(self):

package.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@
5555
"watch:labextension": "jupyter labextension watch ."
5656
},
5757
"dependencies": {
58-
"@emotion/react": "^11.10.4",
59-
"@emotion/styled": "^11.10.4",
58+
"@emotion/react": "^11.10.5",
59+
"@emotion/styled": "^11.10.5",
6060
"@jupyterlab/application": "^4",
6161
"@jupyterlab/apputils": "^4",
6262
"@jupyterlab/coreutils": "^6",
@@ -69,7 +69,7 @@
6969
"@lumino/polling": "^2",
7070
"@lumino/signaling": "^2",
7171
"@lumino/widgets": "^2",
72-
"@mui/icons-material": "^5.10.9",
72+
"@mui/icons-material": "^5.11.0",
7373
"@mui/material": "^5.10.6",
7474
"@mui/system": "^5.10.6",
7575
"@types/react-dom": "^18.0.5",
@@ -83,10 +83,11 @@
8383
"@babel/preset-env": "^7.0.0",
8484
"@jupyterlab/builder": "^4",
8585
"@jupyterlab/testutils": "^4",
86+
"@stylistic/eslint-plugin": "^3.0.1",
8687
"@types/jest": "^29",
87-
"@typescript-eslint/eslint-plugin": "^4.8.1",
88-
"@typescript-eslint/parser": "^4.8.1",
89-
"eslint": "^7.14.0",
88+
"@typescript-eslint/eslint-plugin": "^8.0.0",
89+
"@typescript-eslint/parser": "^8.0.0",
90+
"eslint": "^8.56.0",
9091
"eslint-config-prettier": "^6.15.0",
9192
"eslint-plugin-prettier": "^3.1.4",
9293
"jest": "^29",

src/components/schedule-inputs.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ export function ScheduleInputs<
222222
const scheduleHelperText = useMemo(() => {
223223
try {
224224
return cronstrue.toString(props.model.schedule);
225-
} catch (e) {
225+
} catch {
226226
return '';
227227
}
228228
}, [props.model.schedule]);

src/handler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ async function requestAPI<T>(
323323
if (expectData && data.length > 0) {
324324
try {
325325
data = JSON.parse(data);
326-
} catch (error) {
326+
} catch {
327327
console.error('Not a JSON response body.', response);
328328
}
329329
}

src/mainviews/detail-view/job-definition.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ export function JobDefinition(props: IJobDefinitionProps): JSX.Element {
129129
if (model.schedule !== undefined) {
130130
cronString = cronstrue.toString(model.schedule);
131131
}
132-
} catch (e) {
132+
} catch {
133133
// Do nothing; let the errors or nothing display instead
134134
}
135135

src/model.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ export function emptyUpdateJobDefinitionModel(): IUpdateJobDefinitionModel {
145145
};
146146
}
147147

148-
// eslint-disable-next-line @typescript-eslint/no-empty-interface
148+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
149149
export interface IListJobsModel extends PartialJSONObject {
150150
/* reserved */
151151
}
4.81 KB
Loading
4.74 KB
Loading
3.8 KB
Loading

0 commit comments

Comments
 (0)