Skip to content

Commit 0455f48

Browse files
committed
add frontend linter, run ruff format
1 parent b98cd16 commit 0455f48

9 files changed

Lines changed: 667 additions & 613 deletions

File tree

backend/file_utils/csv_methods_writer.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33

44
def write_launch_info_to_csv(
5-
*,
6-
parsed_methods: list[str],
7-
output_file: str,
5+
*,
6+
parsed_methods: list[str],
7+
output_file: str,
88
) -> None:
99
with open(output_file, "w") as csvfile:
1010
writer = csv.writer(csvfile)

backend/utils/methods_handler.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@
77
class Methods:
88
@staticmethod
99
def save_selection_to_frontend_file(
10-
selection_dataset, front_selection_resource_path
10+
selection_dataset, front_selection_resource_path
1111
):
1212
with open(front_selection_resource_path, "w") as f:
1313
f.write("export const METHODS = ")
1414
json.dump(selection_dataset, f, indent=4)
1515

1616
@staticmethod
1717
def parse_frontend_file_to_dll_methods(
18-
front_selection_resource_path,
18+
front_selection_resource_path,
1919
):
2020
with open(front_selection_resource_path, "r") as f:
2121
content = f.read()
22-
json_str = content[len(FRONT_SELECTION_PREFIX):]
22+
json_str = content[len(FRONT_SELECTION_PREFIX) :]
2323
selection_tree = json.loads(json_str)
2424

2525
dll_methods = defaultdict(list)

backend/utils/tests/test_methods_handler.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def test_write_selection_dataset_to_front_file():
1818
content = temp_file.read()
1919

2020
assert content.startswith("export const METHODS = ")
21-
json_str = content[len("export const METHODS = "):]
21+
json_str = content[len("export const METHODS = ") :]
2222
written_data = json.loads(json_str)
2323
assert written_data == test_data
2424

@@ -29,7 +29,7 @@ def test_write_selection_dataset_to_front_file_empty():
2929

3030
temp_file.seek(0)
3131
content = temp_file.read()
32-
json_str = content[len("export const METHODS = "):]
32+
json_str = content[len("export const METHODS = ") :]
3333
assert json.loads(json_str) == []
3434

3535

frontend/eslint.config.js

Lines changed: 47 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,52 @@
1-
import js from '@eslint/js'
2-
import globals from 'globals'
3-
import reactHooks from 'eslint-plugin-react-hooks'
4-
import reactRefresh from 'eslint-plugin-react-refresh'
5-
import tseslint from 'typescript-eslint'
6-
import { defineConfig, globalIgnores } from 'eslint/config'
1+
import js from '@eslint/js';
2+
import typescript from '@typescript-eslint/eslint-plugin';
3+
import typescriptParser from '@typescript-eslint/parser';
74

8-
export default defineConfig([
9-
globalIgnores(['dist']),
5+
export default [
6+
js.configs.recommended,
107
{
11-
files: ['**/*.{ts,tsx}'],
12-
extends: [
13-
js.configs.recommended,
14-
tseslint.configs.recommended,
15-
reactHooks.configs.flat.recommended,
16-
reactRefresh.configs.vite,
17-
],
8+
files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'],
189
languageOptions: {
19-
ecmaVersion: 2020,
20-
globals: globals.browser,
10+
parser: typescriptParser,
11+
parserOptions: {
12+
ecmaVersion: 'latest',
13+
sourceType: 'module',
14+
ecmaFeatures: {
15+
jsx: true,
16+
},
17+
},
18+
globals: {
19+
console: 'readonly',
20+
document: 'readonly',
21+
window: 'readonly',
22+
fetch: 'readonly',
23+
FormData: 'readonly',
24+
File: 'readonly',
25+
setTimeout: 'readonly',
26+
clearTimeout: 'readonly',
27+
localStorage: 'readonly',
28+
sessionStorage: 'readonly',
29+
URL: 'readonly',
30+
Blob: 'readonly',
31+
FileReader: 'readonly',
32+
},
33+
},
34+
plugins: {
35+
'@typescript-eslint': typescript,
36+
},
37+
rules: {
38+
'@typescript-eslint/no-explicit-any': 'warn',
39+
'@typescript-eslint/no-unused-vars': ['error', {
40+
argsIgnorePattern: '^_',
41+
varsIgnorePattern: '^_'
42+
}],
43+
'no-undef': 'off',
44+
'no-unused-vars': 'off',
45+
},
46+
settings: {
47+
react: {
48+
version: 'detect',
49+
},
2150
},
2251
},
23-
])
52+
];

0 commit comments

Comments
 (0)