Skip to content

Commit c42eafa

Browse files
committed
Fixing lint
1 parent 8aaca2b commit c42eafa

Some content is hidden

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

47 files changed

+190
-119
lines changed

app/bun.lockb

-21.4 KB
Binary file not shown.

app/eslint.config.ts

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
import type { Linter } from 'eslint';
2+
import react from 'eslint-plugin-react';
3+
import globals from 'globals';
4+
import eslintJS from '@eslint/js';
5+
import eslintTS from 'typescript-eslint';
6+
7+
const config: Linter.Config[] = [
8+
...eslintTS.configs.recommended as Linter.Config[],
9+
{
10+
...eslintJS.configs.recommended,
11+
files: ['**/*.{ts,mts,tsx}'],
12+
ignores: ['*.js'],
13+
plugins: {
14+
react
15+
},
16+
settings: {
17+
react: {
18+
...react.configs.recommended.settings,
19+
version: 'detect'
20+
}
21+
},
22+
languageOptions: {
23+
parserOptions: {
24+
ecmaFeatures: {
25+
jsx: true
26+
}
27+
},
28+
globals: {
29+
...globals.browser,
30+
}
31+
},
32+
rules: {
33+
...react.configs.recommended.rules,
34+
'no-restricted-globals': ['error'],
35+
'no-console': ['error', {
36+
allow: ['warn', 'error']
37+
}],
38+
'@typescript-eslint/no-explicit-any': 'warn',
39+
'@typescript-eslint/no-unused-vars': 'off',
40+
'@typescript-eslint/no-unused-expressions': 'off',
41+
'@typescript-eslint/no-empty-object-type': 'off',
42+
'react/prop-types': 'off',
43+
'react/no-unescaped-entities': 'off',
44+
'no-script-url': 'error',
45+
'no-eval': 'error',
46+
'quotes': [
47+
'error',
48+
'single',
49+
{ allowTemplateLiterals: true }
50+
],
51+
'jsx-quotes': [
52+
'error',
53+
'prefer-double',
54+
],
55+
'@typescript-eslint/prefer-ts-expect-error': 'error',
56+
'object-curly-spacing': [
57+
'error',
58+
'always'
59+
],
60+
'array-bracket-spacing': [
61+
'error',
62+
'never'
63+
],
64+
'eqeqeq': [
65+
'error',
66+
'smart',
67+
],
68+
'no-multi-spaces': 'error'
69+
}
70+
}
71+
];
72+
export default config;

app/package.json

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,14 @@
1111
"test": "TZ=NZ jest",
1212
"typecheck": "tsc --noEmit --p ./tsconfig.json",
1313
"typecheck:watch": "tsc --noEmit --watch -p ./tsconfig.json",
14-
"lint": "echo \"DISABLED UNTIL I CAN FIX THE DEP ERROR\""
14+
"lint": "eslint --flag unstable_ts_config src/",
15+
"lint:fix": "eslint --flag unstable_ts_config --fix src/"
1516
},
1617
"engines": {
1718
"node": ">=17.1.0"
1819
},
1920
"dependencies": {
21+
"@eslint/js": "^9.9.0",
2022
"@fontsource/abeezee": "^4.5.10",
2123
"@monaco-editor/react": "^4.6.0",
2224
"@nick_webster/photon": "^0.3.1",
@@ -25,6 +27,7 @@
2527
"@sentry/integrations": "^7.114.0",
2628
"@sentry/react": "^7.118.0",
2729
"@sentry/tracing": "^7.114.0",
30+
"@types/eslint": "^9.6.0",
2831
"browserslist-useragent-regexp": "^4.1.3",
2932
"date-fns": "^2.30.0",
3033
"deep-freeze": "~0.0.1",
@@ -141,9 +144,10 @@
141144
"@babel/core": "^7.25.2",
142145
"@babel/plugin-syntax-flow": "^7.24.7",
143146
"@babel/plugin-transform-react-jsx": "^7.25.2",
144-
"@eslint/eslintrc": "^2.1.4",
147+
"@eslint/eslintrc": "^3.1.0",
145148
"@sentry/esbuild-plugin": "^2.22.0",
146149
"@types/deep-freeze": "^0.1.5",
150+
"@types/eslint__js": "^8.42.3",
147151
"@types/html-minifier": "^4.0.5",
148152
"@types/jest": "^27.5.2",
149153
"@types/jest-image-snapshot": "^4.3.2",
@@ -154,22 +158,13 @@
154158
"@types/react-dom": "^17.0.25",
155159
"@types/semver": "^7.5.8",
156160
"@types/showdown": "^1.9.4",
157-
"@typescript-eslint/eslint-plugin": "^5.62.0",
158-
"@typescript-eslint/parser": "^5.62.0",
159161
"babel-eslint": "^10.1.0",
160162
"browserslist": "^4.23.3",
161163
"esbuild": "~0.16.17",
162164
"esbuild-plugin-browserslist": "~0.6.0",
163165
"esbuild-plugin-manifest": "~0.5.0",
164-
"eslint": "^8.57.0",
165-
"eslint-config-react-app": "^7.0.1",
166-
"eslint-plugin-flowtype": "^8.0.3",
167-
"eslint-plugin-import": "^2.29.1",
168-
"eslint-plugin-jest": "^26.9.0",
169-
"eslint-plugin-jest-playwright": "~0.9.0",
170-
"eslint-plugin-jsx-a11y": "^6.9.0",
166+
"eslint": "^9.9.0",
171167
"eslint-plugin-react": "^7.35.0",
172-
"eslint-plugin-react-hooks": "^4.6.2",
173168
"expect-playwright": "^0.8.0",
174169
"html-minifier": "^4.0.0",
175170
"jest": "^27.5.1",
@@ -179,9 +174,11 @@
179174
"jest-junit": "^13.2.0",
180175
"jest-playwright-preset": "^1.7.2",
181176
"jest-runner": "^27.5.1",
177+
"jiti": "^1.21.6",
182178
"playwright": "^1.46.0",
183179
"servor": "^4.0.2",
184180
"ts-jest": "^27.1.5",
181+
"typescript-eslint": "^8.1.0",
185182
"workbox-build": "^6.6.1"
186183
},
187184
"resolutions": {

app/src/app/actions.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -52,24 +52,24 @@ type ActionTypes = {
5252
const actionCreator = actionCreatorFactory();
5353

5454
export const actions = {
55-
parseNpx: actionCreator.async<string, FlatNotepad, any>('PARSE_NPX'),
56-
saveNotepad: actionCreator.async<Notepad, void, any>('SAVE_NOTEPAD'),
57-
getNotepadList: actionCreator.async<void, string[], any>('GET_NOTEPAD_LIST'),
58-
downloadNotepad: actionCreator.async<string, string, any>('DOWNLOAD_NOTEPAD'),
59-
openNotepadFromStorage: actionCreator.async<string, void, any>('OPEN_NOTEPAD_FROM_STORAGE'),
60-
renameNotepad: actionCreator.async<string, string, any>('RENAME_NOTEPAD'),
61-
checkNoteAssets: actionCreator.async<[string, NoteElement[]], FlatNotepad, any>('CHECK_NOTE_ASSETS'),
62-
loadNote: actionCreator.async<string, object, any>('LOAD_NOTE'),
63-
expandAllExplorer: actionCreator.async<void, string[], any>('EXPAND_ALL_EXPLORER'),
55+
parseNpx: actionCreator.async<string, FlatNotepad, unknown>('PARSE_NPX'),
56+
saveNotepad: actionCreator.async<Notepad, void, void>('SAVE_NOTEPAD'),
57+
getNotepadList: actionCreator.async<void, string[], void>('GET_NOTEPAD_LIST'),
58+
downloadNotepad: actionCreator.async<string, string, void>('DOWNLOAD_NOTEPAD'),
59+
openNotepadFromStorage: actionCreator.async<string, void, unknown>('OPEN_NOTEPAD_FROM_STORAGE'),
60+
renameNotepad: actionCreator.async<string, string, void>('RENAME_NOTEPAD'),
61+
checkNoteAssets: actionCreator.async<[string, NoteElement[]], FlatNotepad, void>('CHECK_NOTE_ASSETS'),
62+
loadNote: actionCreator.async<string, object, Error>('LOAD_NOTE'),
63+
expandAllExplorer: actionCreator.async<void, string[], void>('EXPAND_ALL_EXPLORER'),
6464
print: actionCreator.async<void, NoteElement, void>('PRINT'),
65-
syncLogin: actionCreator.async<SyncLoginRequest, SyncUser, any>('SYNC_LOGIN'),
66-
getSyncedNotepadList: actionCreator.async<SyncUser, CombinedNotepadSyncList, any>('SYNC_GET_NOTEPAD_LIST'),
67-
syncDownload: actionCreator.async<string, Notepad, any>('SYNC_DOWNLOAD'),
65+
syncLogin: actionCreator.async<SyncLoginRequest, SyncUser, void>('SYNC_LOGIN'),
66+
getSyncedNotepadList: actionCreator.async<SyncUser, CombinedNotepadSyncList, void>('SYNC_GET_NOTEPAD_LIST'),
67+
syncDownload: actionCreator.async<string, Notepad, void>('SYNC_DOWNLOAD'),
6868
syncUpload: actionCreator.async<SyncAction, void, any>('SYNC_UPLOAD'),
69-
deleteFromSync: actionCreator.async<string, void, any>('SYNC_DELETE'),
70-
addToSync: actionCreator.async<AddToSyncAction, string, any>('SYNC_CREATE'),
69+
deleteFromSync: actionCreator.async<string, void, void>('SYNC_DELETE'),
70+
addToSync: actionCreator.async<AddToSyncAction, string, void>('SYNC_CREATE'),
7171
quickNote: actionCreator.async<void, string, void>('QUICK_NOTE'),
72-
indexNotepads: actionCreator.async<void, SearchIndices, any>('INDEX_NOTEPADS'),
72+
indexNotepads: actionCreator.async<void, SearchIndices, void>('INDEX_NOTEPADS'),
7373
exportAll: actionCreator.async<void, Blob, Error>('EXPORT_ALL_NOTEPADS'),
7474
exportToMarkdown: actionCreator.async<void, Blob, Error>('EXPORT_ALL_NOTEPADS_TO_MD'),
7575
clearOldData: actionCreator.async<{ silent: boolean }, void, Error>('CLEAR_OLD_DATA'),

app/src/app/components/NavItem.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@ const NavItem2 = React.memo((props: NavItemProps) => {
1414
// @ts-expect-error Adding an extra property that's not on the type (onTouchEnd). The real JS uses it.
1515
return <NavItem {...props} onClick={IS_IOS ? undefined : props.onClick} onTouchStart={onTouchStart} onTouchMove={onTouchMove} onTouchEnd={IS_IOS ? onTouchEnd : undefined} />;
1616
});
17+
NavItem2.displayName = 'NavItem2';
1718

1819
export default NavItem2;

app/src/app/components/explorer/NotepadExplorerComponent.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ import AppSettingsComponent from './app-settings/AppSettingsContainer';
1414

1515
// @ts-expect-error TS2307
1616
import NewSectionVideo from '../../assets/instructions/new-section.mp4';
17-
// @ts-expect-error
17+
// @ts-expect-error TS2307
1818
import OpenNoteVideo from '../../assets/instructions/open-note.mp4';
19-
// @ts-expect-error
19+
// @ts-expect-error TS2307
2020
import OpenNotepadVideo from '../../assets/instructions/open-notepad.mp4';
2121
import { notepadExplorerConnector } from './NotepadExplorerContainer';
2222
import { ConnectedProps } from 'react-redux';

app/src/app/components/explorer/app-settings/AppSettingsComponent.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const AppSettingsComponent = (props: ConnectedProps<typeof appSettingsContainer>
1111

1212
<ul className="app-settings-component__action-list">
1313
<li><QuickSwitchButton /></li>
14-
<li><Button2 flat onClick={() => props.feelingLucky()}>I'm feeling lucky</Button2></li>
14+
<li><Button2 flat onClick={() => props.feelingLucky()}>I&apos;m feeling lucky</Button2></li>
1515
{props.cryptoStatus.hasEncryptedNotebooks && <li><Button2 flat onClick={() => props.clearOldData()}>Clear old/unused data</Button2></li>}
1616
{props.cryptoStatus.hasSavedPasswords && <li><Button2 flat onClick={() => props.forgetSavedPasswords()}>Forget saved passwords</Button2></li>}
1717
</ul>

app/src/app/components/header/notepad-dropdown/NotepadDropdownComponent.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const NotepadDropdownComponent = React.memo((props: Props) => {
2525
const { notepadTitles, syncState, downloadNotepad } = props;
2626

2727
const openNotepad = (event) => {
28-
let title = event.currentTarget.textContent;
28+
const title = event.currentTarget.textContent;
2929
props.openNotepadFromStorage(title);
3030
};
3131

@@ -34,8 +34,8 @@ const NotepadDropdownComponent = React.memo((props: Props) => {
3434
if (!title) return;
3535

3636
let notepad = new FlatNotepad(title);
37-
let section = FlatNotepad.makeFlatSection('Unorganised Notes');
38-
let note = new Note('Untitled Note').clone({ parent: section.internalRef });
37+
const section = FlatNotepad.makeFlatSection('Unorganised Notes');
38+
const note = new Note('Untitled Note').clone({ parent: section.internalRef });
3939
notepad = notepad.addSection(section).addNote(note);
4040

4141
if (title) props.newNotepad!(notepad);
@@ -78,5 +78,6 @@ const NotepadDropdownComponent = React.memo((props: Props) => {
7878
</Dropdown>
7979
);
8080
});
81+
NotepadDropdownComponent.displayName = 'NotepadDropdownComponent';
8182

8283
export default NotepadDropdownComponent;

app/src/app/components/header/upload-notepads/UploadNotepadsComponent.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export default class UploadNotepadsComponent extends React.Component<IUploadNote
4545
const zip = new JSZip();
4646
zip.loadAsync(arrayBuffer)
4747
.then(() => {
48-
for (let name in zip.files) {
48+
for (const name in zip.files) {
4949
if (name.split('.').pop()!.toLowerCase() !== 'npx') continue;
5050

5151
zip.file(name)!.async('text')

app/src/app/components/note-element-modal/NoteElementModalComponent.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,15 @@ async function renderNote({ npx, findNote }: Props): Promise<RenderedNote> {
6161
regex: /(===[^]+?===|''[^]+?''|;;[^]+?;;|\$\$[^]+?\$\$|\$[^]+?\$)/gi,
6262
replace: function(s: string, match: string) {
6363
matches.push('&lt;Maths won\'t display in this view. See the help notepad.&gt;<br />' + match);
64-
let n = matches.length - 1;
64+
const n = matches.length - 1;
6565
return '%ph' + n + 'ph%';
6666
}
6767
},
6868
{
6969
type: 'output',
7070
filter: function(text: string) {
7171
for (let i = 0; i < matches.length; ++i) {
72-
let pat = '%ph' + i + 'ph%';
72+
const pat = '%ph' + i + 'ph%';
7373
text = text.replace(new RegExp(pat, 'gi'), matches[i]);
7474
}
7575
// reset array

0 commit comments

Comments
 (0)