Skip to content

Commit 1c3748d

Browse files
author
Alexis
committed
fix: linting
1 parent ae0a1f7 commit 1c3748d

File tree

12 files changed

+68
-72
lines changed

12 files changed

+68
-72
lines changed

client/components/Nav/NavDropdownMenu.jsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ function NavDropdownMenu({ id, title, children }) {
1111

1212
const { createDropdownHandlers } = useContext(NavBarContext);
1313

14-
const handlers = useMemo(() => createDropdownHandlers(id), [
15-
createDropdownHandlers,
16-
id
17-
]);
14+
const handlers = useMemo(
15+
() => createDropdownHandlers(id),
16+
[createDropdownHandlers, id]
17+
);
1818

1919
return (
2020
<li className={classNames('nav__item', isOpen && 'nav__item--open')}>

client/components/Nav/NavMenuItem.jsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ function NavMenuItem({ hideIf, ...rest }) {
88

99
const { createMenuItemHandlers } = useContext(NavBarContext);
1010

11-
const handlers = useMemo(() => createMenuItemHandlers(parent), [
12-
createMenuItemHandlers,
13-
parent
14-
]);
11+
const handlers = useMemo(
12+
() => createMenuItemHandlers(parent),
13+
[createMenuItemHandlers, parent]
14+
);
1515

1616
if (hideIf) {
1717
return null;

client/components/createRedirectWithUsername.jsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ function mapStateToProps(state) {
2222

2323
const ConnectedRedirectToUser = connect(mapStateToProps)(RedirectToUser);
2424

25-
const createRedirectWithUsername = (url) => (props) => (
26-
<ConnectedRedirectToUser {...props} url={url} />
27-
);
25+
const createRedirectWithUsername = (url) => (props) =>
26+
<ConnectedRedirectToUser {...props} url={url} />;
2827

2928
export default createRedirectWithUsername;

client/modules/IDE/components/Console.jsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -206,12 +206,8 @@ const Console = () => {
206206
const isExpanded = useSelector((state) => state.ide.consoleIsExpanded);
207207
const isPlaying = useSelector((state) => state.ide.isPlaying);
208208
const { theme, fontSize } = useSelector((state) => state.preferences);
209-
const {
210-
collapseConsole,
211-
expandConsole,
212-
clearConsole,
213-
dispatchConsoleEvent
214-
} = bindActionCreators({ ...IDEActions, ...ConsoleActions }, useDispatch());
209+
const { collapseConsole, expandConsole, clearConsole, dispatchConsoleEvent } =
210+
bindActionCreators({ ...IDEActions, ...ConsoleActions }, useDispatch());
215211

216212
const cm = useRef({});
217213

client/modules/IDE/components/FileNode.jsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,8 @@ function parseFileName(name) {
4040
}
4141

4242
function FileName({ name }) {
43-
const {
44-
baseName,
45-
firstLetter,
46-
lastLetter,
47-
middleText,
48-
extension
49-
} = parseFileName(name);
43+
const { baseName, firstLetter, lastLetter, middleText, extension } =
44+
parseFileName(name);
5045
return (
5146
<span className="sidebar__file-item-name-text">
5247
<span>{firstLetter}</span>

client/modules/IDE/components/Toolbar.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ class Toolbar extends React.Component {
8686
});
8787
const nameContainerClass = classNames({
8888
'toolbar__project-name-container': true,
89-
'toolbar__project-name-container--editing': this.props.project
90-
.isEditingName
89+
'toolbar__project-name-container--editing':
90+
this.props.project.isEditingName
9191
});
9292

9393
const canEditProjectName = this.canEditProjectName();

client/modules/IDE/pages/MobileIDEView.jsx

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -210,41 +210,43 @@ const handleGlobalKeydown = (props, cmController) => (e) => {
210210
}
211211
};
212212

213-
const autosave = (autosaveInterval, setAutosaveInterval) => (
214-
props,
215-
prevProps
216-
) => {
217-
const {
218-
autosaveProject,
219-
preferences,
220-
ide,
221-
selectedFile: file,
222-
project,
223-
isUserOwner
224-
} = props;
225-
226-
const { selectedFile: oldFile } = prevProps;
227-
228-
const doAutosave = () => autosaveProject(true);
229-
230-
if (isUserOwner && project.id) {
231-
if (preferences.autosave && ide.unsavedChanges && !ide.justOpenedProject) {
232-
if (file.name === oldFile.name && file.content !== oldFile.content) {
233-
if (autosaveInterval) {
234-
clearTimeout(autosaveInterval);
213+
const autosave =
214+
(autosaveInterval, setAutosaveInterval) => (props, prevProps) => {
215+
const {
216+
autosaveProject,
217+
preferences,
218+
ide,
219+
selectedFile: file,
220+
project,
221+
isUserOwner
222+
} = props;
223+
224+
const { selectedFile: oldFile } = prevProps;
225+
226+
const doAutosave = () => autosaveProject(true);
227+
228+
if (isUserOwner && project.id) {
229+
if (
230+
preferences.autosave &&
231+
ide.unsavedChanges &&
232+
!ide.justOpenedProject
233+
) {
234+
if (file.name === oldFile.name && file.content !== oldFile.content) {
235+
if (autosaveInterval) {
236+
clearTimeout(autosaveInterval);
237+
}
238+
console.log('will save project in 20 seconds');
239+
setAutosaveInterval(setTimeout(doAutosave, 20000));
235240
}
236-
console.log('will save project in 20 seconds');
237-
setAutosaveInterval(setTimeout(doAutosave, 20000));
241+
} else if (autosaveInterval && !preferences.autosave) {
242+
clearTimeout(autosaveInterval);
243+
setAutosaveInterval(null);
238244
}
239-
} else if (autosaveInterval && !preferences.autosave) {
245+
} else if (autosaveInterval) {
240246
clearTimeout(autosaveInterval);
241247
setAutosaveInterval(null);
242248
}
243-
} else if (autosaveInterval) {
244-
clearTimeout(autosaveInterval);
245-
setAutosaveInterval(null);
246-
}
247-
};
249+
};
248250

249251
// ide, preferences, project, selectedFile, user, params, unsavedChanges, expandConsole, collapseConsole,
250252
// stopSketch, startSketch, getProject, clearPersistedState, autosaveProject, saveProject, files

client/utils/responsive.jsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ export const mobileFirst = (MobileComponent, Fallback) => (props) => {
2020
);
2121
};
2222

23-
export const responsiveForm = (DesktopComponent) => (props) => (
24-
<ResponsiveForm>
25-
<DesktopComponent {...props} />
26-
</ResponsiveForm>
27-
);
23+
export const responsiveForm = (DesktopComponent) => (props) =>
24+
(
25+
<ResponsiveForm>
26+
<DesktopComponent {...props} />
27+
</ResponsiveForm>
28+
);

server/controllers/embed.controller.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ export function serveProject(req, res) {
1919
}
2020
// TODO this does not parse html
2121
const { files } = project;
22-
const htmlFile = files.find((file) => file.name.match(/\.html$/i))
23-
.content;
22+
const htmlFile = files.find((file) =>
23+
file.name.match(/\.html$/i)
24+
).content;
2425
const filesToInject = files.filter((file) =>
2526
file.name.match(/\.(js|css)$/i)
2627
);

server/controllers/project.controller.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,9 @@ function addFileToZip(file, files, zip, path = '') {
219219
return new Promise((resolve, reject) => {
220220
if (file.fileType === 'folder') {
221221
const newPath = file.name === 'root' ? path : `${path}${file.name}/`;
222-
const numChildFiles = file.children.filter((f) => f.fileType !== 'folder')
223-
.length;
222+
const numChildFiles = file.children.filter(
223+
(f) => f.fileType !== 'folder'
224+
).length;
224225
let childrenAdded = 0;
225226
if (numChildFiles === 0) {
226227
zip.folder(file.name);

server/scripts/examples.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ mongoose.connection.on('error', () => {
2929
async function getCategories() {
3030
const categories = [];
3131
const options = {
32-
url:
33-
'https://api.github.com/repos/processing/p5.js-website/contents/src/data/examples/en',
32+
url: 'https://api.github.com/repos/processing/p5.js-website/contents/src/data/examples/en',
3433
method: 'GET',
3534
headers: {
3635
...headers,
@@ -241,8 +240,7 @@ async function addAssetsToProject(assets, response, project) {
241240

242241
async function createProjectsInP5user(projectsInAllCategories) {
243242
const options = {
244-
url:
245-
'https://api.github.com/repos/processing/p5.js-website/contents/src/data/examples/assets',
243+
url: 'https://api.github.com/repos/processing/p5.js-website/contents/src/data/examples/assets',
246244
method: 'GET',
247245
headers: {
248246
...headers,

server/utils/fileUtils.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,13 @@ export const MEDIA_FILE_QUOTED_REGEX = new RegExp(
6666

6767
export const STRING_REGEX = /(['"])((\\\1|.)*?)\1/gm;
6868
// these are files that have to be linked to with a blob url
69-
export const PLAINTEXT_FILE_REGEX = /.+\.(json|txt|csv|vert|frag|tsv|xml|stl)$/i;
69+
export const PLAINTEXT_FILE_REGEX =
70+
/.+\.(json|txt|csv|vert|frag|tsv|xml|stl)$/i;
7071
// these are files that users would want to edit as text (maybe svg should be here?)
71-
export const TEXT_FILE_REGEX = /.+\.(json|txt|csv|tsv|vert|frag|js|css|html|htm|jsx|xml|stl)$/i;
72+
export const TEXT_FILE_REGEX =
73+
/.+\.(json|txt|csv|tsv|vert|frag|js|css|html|htm|jsx|xml|stl)$/i;
7274
export const NOT_EXTERNAL_LINK_REGEX = /^(?!(http:\/\/|https:\/\/))/;
7375
export const EXTERNAL_LINK_REGEX = /^(http:\/\/|https:\/\/)/;
7476

75-
export const CREATE_FILE_REGEX = /.+\.(json|txt|csv|tsv|js|css|frag|vert|xml|html|htm|stl)$/i;
77+
export const CREATE_FILE_REGEX =
78+
/.+\.(json|txt|csv|tsv|js|css|frag|vert|xml|html|htm|stl)$/i;

0 commit comments

Comments
 (0)