chore: fix linting

pull/9/head
sualko 2020-04-26 22:41:06 +02:00
parent a888627e14
commit cc6cab26f1
15 changed files with 650 additions and 177 deletions

View File

@ -1,5 +1,32 @@
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: {
jsx: true, // Allows for the parsing of JSX
},
},
plugins: [
'@typescript-eslint',
],
settings: {
react: {
version: 'detect', // Tells eslint-plugin-react to automatically detect the version of React to use
},
},
extends: [
'nextcloud',
]
}
'plugin:react/recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
],
rules: {
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'react/prop-types': 'off',
quotes: ['error', 'single'],
'comma-dangle': ['error', 'always-multiline'],
'array-bracket-newline': ['error', 'consistent'],
'quote-props': ['error', 'as-needed'],
},
}

6
.stylelintrc.json Normal file
View File

@ -0,0 +1,6 @@
{
"extends": "stylelint-config-recommended-scss",
"rules": {
"indentation": 2
}
}

View File

@ -7,7 +7,7 @@ use OCP\IRequest;
use OCP\ISession;
use OCP\IUserSession;
use OCP\IConfig;
use \OCP\IURLGenerator;
use OCP\IURLGenerator;
use OCA\BigBlueButton\Service\RoomService;
use BigBlueButton\BigBlueButton;
use BigBlueButton\Parameters\CreateMeetingParameters;

View File

@ -23,8 +23,7 @@ class RoomApiController extends ApiController
IRequest $request,
RoomService $service,
$userId
)
{
) {
parent::__construct($appName, $request);
$this->service = $service;
$this->userId = $userId;
@ -62,8 +61,7 @@ class RoomApiController extends ApiController
string $welcome,
int $maxParticipants,
bool $record
): DataResponse
{
): DataResponse {
return new DataResponse($this->service->create(
$name,
$welcome,
@ -84,8 +82,7 @@ class RoomApiController extends ApiController
string $welcome,
int $maxParticipants,
bool $record
): DataResponse
{
): DataResponse {
return $this->handleNotFound(function () use ($id, $name, $welcome, $maxParticipants, $record) {
return $this->service->update($id, $name, $welcome, $maxParticipants, $record, $this->userId);
});

View File

@ -17,16 +17,27 @@
"build": "NODE_ENV=production webpack --progress --hide-modules --config webpack.prod.js",
"dev": "NODE_ENV=development webpack --progress --config webpack.dev.js",
"watch": "NODE_ENV=development webpack --progress --watch --config webpack.dev.js",
"lint": "eslint --ext .js,.vue src",
"lint:fix": "eslint --ext .js,.vue src --fix",
"stylelint": "stylelint src",
"stylelint:fix": "stylelint src --fix"
"fix": "run-p --continue-on-error --print-label lint:fix:*",
"lint": "run-p --continue-on-error --print-label lint:*",
"lint:script": "eslint --ext .tsx,.ts ts",
"lint:fix:script": "eslint --ext .tsx,.ts ts --fix",
"lint:style": "stylelint ts/**/*.scss",
"lint:fix:style": "stylelint ts/**/*.scss --fix",
"lint:php": "./vendor/bin/php-cs-fixer fix --dry-run",
"lint:fix:php": "./vendor/bin/php-cs-fixer fix",
"composer:install": "php composer.phar install --no-dev -o",
"composer:install:dev": "php composer.phar install -o"
},
"dependencies": {
"@nextcloud/axios": "^1.3.2",
"@nextcloud/router": "^1.0.2",
"react-copy-to-clipboard": "^5.0.2"
},
"husky": {
"hooks": {
"pre-commit": "yarn lint"
}
},
"browserslist": [
"extends @nextcloud/browserslist-config"
],
@ -45,11 +56,12 @@
"@types/react": "^16.9.34",
"@types/webpack": "^4.41.12",
"@types/webpack-env": "^1.15.2",
"@typescript-eslint/eslint-plugin": "^2.29.0",
"@typescript-eslint/parser": "^2.29.0",
"babel-eslint": "^10.1.0",
"babel-loader": "^8.1.0",
"css-loader": "^3.4.2",
"eslint": "^5.16.0",
"eslint-config-nextcloud": "0.1.1",
"eslint": "^6.8.0",
"eslint-config-standard": "^12.0.0",
"eslint-import-resolver-webpack": "^0.12.1",
"eslint-loader": "^3.0.4",
@ -57,9 +69,12 @@
"eslint-plugin-nextcloud": "^0.3.0",
"eslint-plugin-node": "^10.0.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-react": "^7.19.0",
"eslint-plugin-standard": "^4.0.1",
"file-loader": "^6.0.0",
"husky": "^4.2.5",
"node-sass": "^4.13.1",
"npm-run-all": "^4.1.5",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-flip-move": "^3.0.4",
@ -70,7 +85,6 @@
"stylelint": "^8.4.0",
"stylelint-config-recommended-scss": "^3.3.0",
"stylelint-scss": "^3.16.0",
"stylelint-webpack-plugin": "^0.10.5",
"ts-loader": "^7.0.1",
"typescript": "^3.8.3",
"url-loader": "^4.0.0",

View File

@ -6,6 +6,7 @@
?>
<form method="get" action="?">
<fieldset class="warning">
<!-- @TODO show room name -->
<?php if (!isset($_['wrongdisplayname']) || !$_['wrongdisplayname']): ?>
<p><?php p($l->t('How is your name?')); ?></p>
<?php endif; ?>

View File

@ -1,12 +1,12 @@
import axios from '@nextcloud/axios';
export interface Room {
id: number
uid: string
name: string
welcome: string
maxParticipants: number
record: boolean
id: number;
uid: string;
name: string;
welcome: string;
maxParticipants: number;
record: boolean;
}
class Api {

View File

@ -5,6 +5,15 @@
#bbb-react-root {
.icon {
display: inline-block;
opacity: 0;
&.icon-visible {
opacity: 0.5;
}
}
&, & > table {
width: 100%;
}
@ -83,15 +92,6 @@
}
}
.icon {
display: inline-block;
opacity: 0;
&.icon-visible {
opacity: 0.5;
}
}
.copy-to-clipboard {
cursor: pointer;
border-radius: 50%;

View File

@ -1,7 +1,7 @@
import React, { useEffect, useState } from 'react';
import './App.scss';
import RoomRow from './RoomRow';
import { SortArrow } from "./SortArrow";
import { SortArrow } from './SortArrow';
import { api, Room } from './Api';
import NewRoomForm from './NewRoomForm';

View File

@ -1,7 +1,7 @@
import React, {useState} from 'react';
type Props = {
addRoom: (name: string) => void
addRoom: (name: string) => void;
}
const NewRoomForm: React.FC<Props> = (props) => {

View File

@ -68,8 +68,8 @@ declare namespace OC {
modRewriteWorking: boolean;
session_keepalive: boolean;
session_lifetime: boolean;
"sharing.maxAutocompleteResults": number;
"sharing.minSearchStringLength": number;
'sharing.maxAutocompleteResults': number;
'sharing.minSearchStringLength': number;
version: string;
versionString: string;
};
@ -87,7 +87,7 @@ declare module 'NC' {
statuscode: number;
totalitems: number;
itemsperpage: number;
}
}
};
};
}
}

View File

@ -4,18 +4,18 @@ import { SubmitInput } from './SubmitInput';
import { Room, api } from './Api';
type Props = {
room: Room
updateRoom: (room: Room) => void
deleteRoom: (id: number) => void
room: Room;
updateRoom: (room: Room) => void;
deleteRoom: (id: number) => void;
}
type EditableValueProps = {
setValue: (key: string, value: string|number) => void
setActive: (key: string) => void
active: string
field: string
value: string
type: 'text' | 'number'
setValue: (key: string, value: string|number) => void;
setActive: (key: string) => void;
active: string;
field: string;
value: string;
type: 'text' | 'number';
}
const EditableValue: React.FC<EditableValueProps> = ({ setValue, setActive, active, field, value, type }) => {

View File

@ -1,7 +1,7 @@
import * as React from 'react';
import {
Component, InputHTMLAttributes,
SyntheticEvent
SyntheticEvent,
} from 'react';
export interface SubmitInputProps extends InputHTMLAttributes<HTMLInputElement> {
@ -16,7 +16,7 @@ export interface SubmitInputState {
export class SubmitInput extends Component<SubmitInputProps, SubmitInputState> {
state: SubmitInputState = {
value: ''
value: '',
};
constructor(props: SubmitInputProps) {
@ -30,11 +30,9 @@ export class SubmitInput extends Component<SubmitInputProps, SubmitInputState> {
};
render() {
const {initialValue, onSubmitValue, ...props} = this.props;
return <form onSubmit={this.onSubmit}>
<input value={this.state.value}
{...props}
{...this.props}
onChange={event => this.setState({value: event.currentTarget.value})}/>
</form>;
}

View File

@ -44,7 +44,7 @@ $(() => {
icon: OC.imagePath('bbb', 'app-dark.svg'),
actionHandler: (fileName, context) => {
share(context.fileInfoModel.getFullPath(), fileName, uid);
}
},
});
}
@ -54,7 +54,7 @@ $(() => {
const joinUrl = generateUrl('/apps/bbb/b/{uid}?u={url}&filename={filename}', {
uid: roomUid,
url: shareUrl + '/download',
filename
filename,
});
window.open(joinUrl, '_blank', 'noopener,noreferrer');

676
yarn.lock

File diff suppressed because it is too large Load Diff