diff --git a/.eslintrc.js b/.eslintrc.js index 80963bb..87d9e7e 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -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'], + }, +} \ No newline at end of file diff --git a/.stylelintrc.json b/.stylelintrc.json new file mode 100644 index 0000000..4dc2008 --- /dev/null +++ b/.stylelintrc.json @@ -0,0 +1,6 @@ +{ + "extends": "stylelint-config-recommended-scss", + "rules": { + "indentation": 2 + } +} diff --git a/lib/Controller/JoinController.php b/lib/Controller/JoinController.php index afbc851..6056567 100644 --- a/lib/Controller/JoinController.php +++ b/lib/Controller/JoinController.php @@ -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; diff --git a/lib/Controller/RoomApiController.php b/lib/Controller/RoomApiController.php index b2d930d..8482114 100644 --- a/lib/Controller/RoomApiController.php +++ b/lib/Controller/RoomApiController.php @@ -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); }); diff --git a/package.json b/package.json index c678873..809249e 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/templates/publicdisplayname.php b/templates/publicdisplayname.php index dce724f..a6e30f4 100644 --- a/templates/publicdisplayname.php +++ b/templates/publicdisplayname.php @@ -6,6 +6,7 @@ ?>