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 = { 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: [ 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\ISession;
use OCP\IUserSession; use OCP\IUserSession;
use OCP\IConfig; use OCP\IConfig;
use \OCP\IURLGenerator; use OCP\IURLGenerator;
use OCA\BigBlueButton\Service\RoomService; use OCA\BigBlueButton\Service\RoomService;
use BigBlueButton\BigBlueButton; use BigBlueButton\BigBlueButton;
use BigBlueButton\Parameters\CreateMeetingParameters; use BigBlueButton\Parameters\CreateMeetingParameters;

View File

@ -23,8 +23,7 @@ class RoomApiController extends ApiController
IRequest $request, IRequest $request,
RoomService $service, RoomService $service,
$userId $userId
) ) {
{
parent::__construct($appName, $request); parent::__construct($appName, $request);
$this->service = $service; $this->service = $service;
$this->userId = $userId; $this->userId = $userId;
@ -62,8 +61,7 @@ class RoomApiController extends ApiController
string $welcome, string $welcome,
int $maxParticipants, int $maxParticipants,
bool $record bool $record
): DataResponse ): DataResponse {
{
return new DataResponse($this->service->create( return new DataResponse($this->service->create(
$name, $name,
$welcome, $welcome,
@ -84,8 +82,7 @@ class RoomApiController extends ApiController
string $welcome, string $welcome,
int $maxParticipants, int $maxParticipants,
bool $record bool $record
): DataResponse ): DataResponse {
{
return $this->handleNotFound(function () use ($id, $name, $welcome, $maxParticipants, $record) { return $this->handleNotFound(function () use ($id, $name, $welcome, $maxParticipants, $record) {
return $this->service->update($id, $name, $welcome, $maxParticipants, $record, $this->userId); 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", "build": "NODE_ENV=production webpack --progress --hide-modules --config webpack.prod.js",
"dev": "NODE_ENV=development webpack --progress --config webpack.dev.js", "dev": "NODE_ENV=development webpack --progress --config webpack.dev.js",
"watch": "NODE_ENV=development webpack --progress --watch --config webpack.dev.js", "watch": "NODE_ENV=development webpack --progress --watch --config webpack.dev.js",
"lint": "eslint --ext .js,.vue src", "fix": "run-p --continue-on-error --print-label lint:fix:*",
"lint:fix": "eslint --ext .js,.vue src --fix", "lint": "run-p --continue-on-error --print-label lint:*",
"stylelint": "stylelint src", "lint:script": "eslint --ext .tsx,.ts ts",
"stylelint:fix": "stylelint src --fix" "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": { "dependencies": {
"@nextcloud/axios": "^1.3.2", "@nextcloud/axios": "^1.3.2",
"@nextcloud/router": "^1.0.2", "@nextcloud/router": "^1.0.2",
"react-copy-to-clipboard": "^5.0.2" "react-copy-to-clipboard": "^5.0.2"
}, },
"husky": {
"hooks": {
"pre-commit": "yarn lint"
}
},
"browserslist": [ "browserslist": [
"extends @nextcloud/browserslist-config" "extends @nextcloud/browserslist-config"
], ],
@ -45,11 +56,12 @@
"@types/react": "^16.9.34", "@types/react": "^16.9.34",
"@types/webpack": "^4.41.12", "@types/webpack": "^4.41.12",
"@types/webpack-env": "^1.15.2", "@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-eslint": "^10.1.0",
"babel-loader": "^8.1.0", "babel-loader": "^8.1.0",
"css-loader": "^3.4.2", "css-loader": "^3.4.2",
"eslint": "^5.16.0", "eslint": "^6.8.0",
"eslint-config-nextcloud": "0.1.1",
"eslint-config-standard": "^12.0.0", "eslint-config-standard": "^12.0.0",
"eslint-import-resolver-webpack": "^0.12.1", "eslint-import-resolver-webpack": "^0.12.1",
"eslint-loader": "^3.0.4", "eslint-loader": "^3.0.4",
@ -57,9 +69,12 @@
"eslint-plugin-nextcloud": "^0.3.0", "eslint-plugin-nextcloud": "^0.3.0",
"eslint-plugin-node": "^10.0.0", "eslint-plugin-node": "^10.0.0",
"eslint-plugin-promise": "^4.2.1", "eslint-plugin-promise": "^4.2.1",
"eslint-plugin-react": "^7.19.0",
"eslint-plugin-standard": "^4.0.1", "eslint-plugin-standard": "^4.0.1",
"file-loader": "^6.0.0", "file-loader": "^6.0.0",
"husky": "^4.2.5",
"node-sass": "^4.13.1", "node-sass": "^4.13.1",
"npm-run-all": "^4.1.5",
"react": "^16.13.1", "react": "^16.13.1",
"react-dom": "^16.13.1", "react-dom": "^16.13.1",
"react-flip-move": "^3.0.4", "react-flip-move": "^3.0.4",
@ -70,7 +85,6 @@
"stylelint": "^8.4.0", "stylelint": "^8.4.0",
"stylelint-config-recommended-scss": "^3.3.0", "stylelint-config-recommended-scss": "^3.3.0",
"stylelint-scss": "^3.16.0", "stylelint-scss": "^3.16.0",
"stylelint-webpack-plugin": "^0.10.5",
"ts-loader": "^7.0.1", "ts-loader": "^7.0.1",
"typescript": "^3.8.3", "typescript": "^3.8.3",
"url-loader": "^4.0.0", "url-loader": "^4.0.0",

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

676
yarn.lock

File diff suppressed because it is too large Load Diff