Remove flow defs and usage, will be using TS

This commit is contained in:
Dane Everitt 2018-12-16 14:11:56 -08:00
parent 8fd0e5ff57
commit cc7f7d7123
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
10 changed files with 110 additions and 88 deletions

View file

@ -4,8 +4,6 @@
],
"plugins": [
["@babel/plugin-proposal-object-rest-spread", { "useBuiltIns": true }],
"babel-plugin-transform-class-properties",
"babel-plugin-syntax-flow",
"babel-plugin-transform-flow-strip-types"
"@babel/plugin-proposal-class-properties"
]
}

View file

@ -1,9 +1,8 @@
{
"parser": "babel-eslint",
"plugins": ["html", "flowtype-errors"],
"plugins": ["html"],
"extends": ["vue"],
"rules": {
"flowtype-errors/show-errors": 2,
"semi": "off",
"indent": ["error", 4],
"comma-dangle": ["error", "always-multiline"],

View file

@ -1,14 +0,0 @@
[ignore]
<PROJECT_ROOT>/vendor/symfony/.*
<PROJECT_ROOT>/tests/.*
<PROJECT_ROOT>/storage/.*
<PROJECT_ROOT>/app/.*
[options]
module.name_mapper='^/\(.*\)$' -> '<PROJECT_ROOT>/\1'
module.file_ext=.js
module.file_ext=.vue
module.file_ext=.json
[version]
0.81.0

View file

@ -15,6 +15,7 @@
},
"devDependencies": {
"@babel/core": "^7.0.0-beta.49",
"@babel/plugin-proposal-class-properties": "^7.2.1",
"@babel/plugin-proposal-object-rest-spread": "^7.0.0-beta.49",
"@babel/plugin-transform-async-to-generator": "^7.0.0-beta.49",
"@babel/plugin-transform-runtime": "^7.0.0-beta.49",
@ -25,8 +26,6 @@
"babel-core": "^6.26.3",
"babel-eslint": "^9.0.0",
"babel-loader": "^8.0.0-beta.3",
"babel-plugin-syntax-flow": "^6.18.0",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-plugin-transform-flow-strip-types": "^6.22.0",
"babel-plugin-transform-object-assign": "^6.22.0",
"babel-plugin-transform-runtime": "^6.23.0",
@ -41,7 +40,6 @@
"eslint-plugin-html": "^4.0.6",
"eslint-plugin-vue": "^4.7.1",
"extract-text-webpack-plugin": "^4.0.0-beta.0",
"flow-bin": "^0.81.0",
"glob-all": "^3.1.0",
"html-webpack-plugin": "^3.2.0",
"jquery": "^3.3.1",

View file

@ -1,12 +1,10 @@
// @flow
import axios from 'axios';
import type { AxiosInstance } from 'axios';
// This token is set in the bootstrap.js file at the beginning of the request
// and is carried through from there.
// const token: string = '';
const http: AxiosInstance = axios.create({
const http = axios.create({
'X-Requested-With': 'XMLHttpRequest',
'Accept': 'application/json',
'Content-Type': 'application/json',

View file

@ -1,23 +1,16 @@
// @flow
import http from './../http';
import filter from 'lodash/filter';
import isObject from 'lodash/isObject';
import route from '../../../../../vendor/tightenco/ziggy/src/js/route';
export interface DirectoryContentsResponse {
files: Object,
directories: Object,
editable: Array<string>,
}
/**
* Get the contents of a specific directory for a given server.
*
* @param {String} server
* @param {String} directory
* @return {Promise<DirectoryContentsResponse>}
* @return {Promise}
*/
export function getDirectoryContents(server: string, directory: string): Promise<DirectoryContentsResponse> {
export function getDirectoryContents (server, directory) {
return new Promise((resolve, reject) => {
http.get(route('server.files', { server, directory }))
.then((response) => {

View file

@ -1,4 +1,3 @@
// @flow
import Vue from 'vue';
import Vuex from 'vuex';
import vuexI18n from 'vuex-i18n';

View file

@ -42,13 +42,11 @@
</template>
<script>
// @flow
import map from 'lodash/map';
import { mapState } from 'vuex';
import type { Route } from 'vue-router';
import FileManagerFileRow from '../components/filemanager/FileManagerFileRow';
import FileManagerFolderRow from '../components/filemanager/FileManagerFolderRow';
import { getDirectoryContents, DirectoryContentsResponse } from '../../../api/server/getDirectoryContents';
import { getDirectoryContents } from '../../../api/server/getDirectoryContents';
export default {
name: 'file-manager-page',
@ -62,13 +60,13 @@ export default {
* Configure the breadcrumbs that display on the filemanager based on the directory that the
* user is currently in.
*/
breadcrumbs: function (): Array<Object> {
const directories: Array<string> = this.currentDirectory.replace(/^\/|\/$/, '').split('/');
breadcrumbs: function () {
const directories = this.currentDirectory.replace(/^\/|\/$/, '').split('/');
if (directories.length < 1 || !directories[0]) {
return [];
}
return map(directories, function (value: string, key: number) {
return map(directories, function (value, key) {
if (key === directories.length - 1) {
return { directoryName: value };
}
@ -85,14 +83,14 @@ export default {
/**
* When the route changes reload the directory.
*/
'$route': function (to: Route) {
'$route': function (to) {
this.currentDirectory = to.params.path || '/';
},
/**
* Watch the current directory setting and when it changes update the file listing.
*/
currentDirectory: function (): void {
currentDirectory: function () {
this.listDirectory();
},
@ -100,7 +98,7 @@ export default {
* When we reconnect to the Daemon make sure we grab a listing of all of the files
* so that the error message disappears and we then load in a fresh listing.
*/
connected: function (): void {
connected: function () {
if (this.connected) {
this.listDirectory();
}
@ -127,18 +125,18 @@ export default {
/**
* List the contents of a directory.
*/
listDirectory: function (): void {
listDirectory: function () {
this.loading = true;
const directory: string = encodeURI(this.currentDirectory.replace(/^\/|\/$/, ''));
const directory = encodeURI(this.currentDirectory.replace(/^\/|\/$/, ''));
getDirectoryContents(this.$route.params.id, directory)
.then((response: DirectoryContentsResponse) => {
.then((response) => {
this.files = response.files;
this.directories = response.directories;
this.editableFiles = response.editable;
this.errorMessage = null;
})
.catch((err: string|Object) => {
.catch((err) => {
if (err instanceof String) {
this.errorMessage = err;
return;

View file

@ -1,4 +1,3 @@
// @flow
import format from 'date-fns/format';
/**
@ -8,13 +7,13 @@ import format from 'date-fns/format';
* @param {Number} bytes
* @return {String}
*/
export function readableSize (bytes: number): string {
export function readableSize (bytes) {
if (Math.abs(bytes) < 1024) {
return `${bytes} Bytes`;
}
let u: number = -1;
const units: Array<string> = ['KiB', 'MiB', 'GiB', 'TiB'];
let u = -1;
const units = ['KiB', 'MiB', 'GiB', 'TiB'];
do {
bytes /= 1024;
@ -30,6 +29,6 @@ export function readableSize (bytes: number): string {
* @param {String} date
* @return {String}
*/
export function formatDate (date: string): string {
export function formatDate (date) {
return format(date, 'MMM D, YYYY [at] HH:MM');
}

124
yarn.lock
View file

@ -70,6 +70,16 @@
source-map "^0.5.0"
trim-right "^1.0.1"
"@babel/generator@^7.2.2":
version "7.2.2"
resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.2.2.tgz#18c816c70962640eab42fe8cae5f3947a5c65ccc"
dependencies:
"@babel/types" "^7.2.2"
jsesc "^2.5.1"
lodash "^4.17.10"
source-map "^0.5.0"
trim-right "^1.0.1"
"@babel/helper-annotate-as-pure@7.0.0-beta.49":
version "7.0.0-beta.49"
resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.0.0-beta.49.tgz#7d9005d54fe7ad6cb876790251e75575419186e9"
@ -91,6 +101,16 @@
"@babel/traverse" "7.0.0-beta.49"
"@babel/types" "7.0.0-beta.49"
"@babel/helper-create-class-features-plugin@^7.2.1":
version "7.2.2"
resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.2.2.tgz#aac79552e41c94716a804d371e943f20171df0c5"
dependencies:
"@babel/helper-function-name" "^7.1.0"
"@babel/helper-member-expression-to-functions" "^7.0.0"
"@babel/helper-optimise-call-expression" "^7.0.0"
"@babel/helper-plugin-utils" "^7.0.0"
"@babel/helper-replace-supers" "^7.1.0"
"@babel/helper-define-map@7.0.0-beta.49":
version "7.0.0-beta.49"
resolved "https://registry.yarnpkg.com/@babel/helper-define-map/-/helper-define-map-7.0.0-beta.49.tgz#4ea067aa720937240df395cd073c24fcad9c2b3b"
@ -160,6 +180,12 @@
dependencies:
"@babel/types" "7.0.0-beta.49"
"@babel/helper-member-expression-to-functions@^7.0.0":
version "7.0.0"
resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.0.0.tgz#8cd14b0a0df7ff00f009e7d7a436945f47c7a16f"
dependencies:
"@babel/types" "^7.0.0"
"@babel/helper-module-imports@7.0.0-beta.49":
version "7.0.0-beta.49"
resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.0.0-beta.49.tgz#41d7d59891016c493432a46f7464446552890c75"
@ -184,10 +210,20 @@
dependencies:
"@babel/types" "7.0.0-beta.49"
"@babel/helper-optimise-call-expression@^7.0.0":
version "7.0.0"
resolved "https://registry.yarnpkg.com/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.0.0.tgz#a2920c5702b073c15de51106200aa8cad20497d5"
dependencies:
"@babel/types" "^7.0.0"
"@babel/helper-plugin-utils@7.0.0-beta.49":
version "7.0.0-beta.49"
resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.0.0-beta.49.tgz#0e9fcbb834f878bb365d2a8ea90eee21ba3ccd23"
"@babel/helper-plugin-utils@^7.0.0":
version "7.0.0"
resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.0.0.tgz#bbb3fbee98661c569034237cc03967ba99b4f250"
"@babel/helper-regex@7.0.0-beta.49":
version "7.0.0-beta.49"
resolved "https://registry.yarnpkg.com/@babel/helper-regex/-/helper-regex-7.0.0-beta.49.tgz#ff244f19c2a2f167ff4b3165a636b08fd641816b"
@ -213,6 +249,15 @@
"@babel/traverse" "7.0.0-beta.49"
"@babel/types" "7.0.0-beta.49"
"@babel/helper-replace-supers@^7.1.0":
version "7.1.0"
resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.1.0.tgz#5fc31de522ec0ef0899dc9b3e7cf6a5dd655f362"
dependencies:
"@babel/helper-member-expression-to-functions" "^7.0.0"
"@babel/helper-optimise-call-expression" "^7.0.0"
"@babel/traverse" "^7.1.0"
"@babel/types" "^7.0.0"
"@babel/helper-simple-access@7.0.0-beta.49":
version "7.0.0-beta.49"
resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.0.0-beta.49.tgz#97a41e2789a9bf8a6c30536a258b79e7444c5d82"
@ -288,6 +333,10 @@
version "7.1.0"
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.1.0.tgz#a7cd42cb3c12aec52e24375189a47b39759b783e"
"@babel/parser@^7.2.2":
version "7.2.2"
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.2.2.tgz#37ebdbc88a2e1ebc6c8dd3d35ea9436e3e39e477"
"@babel/plugin-proposal-async-generator-functions@7.0.0-beta.49":
version "7.0.0-beta.49"
resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.0.0-beta.49.tgz#8761a5e2d8b5251e70df28f4d0aa64aa28a596b1"
@ -296,6 +345,13 @@
"@babel/helper-remap-async-to-generator" "7.0.0-beta.49"
"@babel/plugin-syntax-async-generators" "7.0.0-beta.49"
"@babel/plugin-proposal-class-properties@^7.2.1":
version "7.2.1"
resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.2.1.tgz#c734a53e0a1ec40fe5c22ee5069d26da3b187d05"
dependencies:
"@babel/helper-create-class-features-plugin" "^7.2.1"
"@babel/helper-plugin-utils" "^7.0.0"
"@babel/plugin-proposal-object-rest-spread@7.0.0-beta.49", "@babel/plugin-proposal-object-rest-spread@^7.0.0-beta.49":
version "7.0.0-beta.49"
resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.0.0-beta.49.tgz#6d0cd60f7a7bd7c444a371c4e9470bff02f5777c"
@ -645,6 +701,20 @@
globals "^11.1.0"
lodash "^4.17.10"
"@babel/traverse@^7.1.0":
version "7.2.2"
resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.2.2.tgz#961039de1f9bcb946d807efe2dba9c92e859d188"
dependencies:
"@babel/code-frame" "^7.0.0"
"@babel/generator" "^7.2.2"
"@babel/helper-function-name" "^7.1.0"
"@babel/helper-split-export-declaration" "^7.0.0"
"@babel/parser" "^7.2.2"
"@babel/types" "^7.2.2"
debug "^4.1.0"
globals "^11.1.0"
lodash "^4.17.10"
"@babel/types@7.0.0-beta.44":
version "7.0.0-beta.44"
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.0.0-beta.44.tgz#6b1b164591f77dec0a0342aca995f2d046b3a757"
@ -669,6 +739,14 @@
lodash "^4.17.10"
to-fast-properties "^2.0.0"
"@babel/types@^7.2.2":
version "7.2.2"
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.2.2.tgz#44e10fc24e33af524488b716cdaee5360ea8ed1e"
dependencies:
esutils "^2.0.2"
lodash "^4.17.10"
to-fast-properties "^2.0.0"
"@csstools/convert-colors@^1.4.0":
version "1.4.0"
resolved "https://registry.yarnpkg.com/@csstools/convert-colors/-/convert-colors-1.4.0.tgz#ad495dc41b12e75d588c6db8b9834f08fa131eb7"
@ -1236,23 +1314,6 @@ babel-generator@^6.26.0:
source-map "^0.5.7"
trim-right "^1.0.1"
babel-helper-function-name@^6.24.1:
version "6.24.1"
resolved "https://registry.yarnpkg.com/babel-helper-function-name/-/babel-helper-function-name-6.24.1.tgz#d3475b8c03ed98242a25b48351ab18399d3580a9"
dependencies:
babel-helper-get-function-arity "^6.24.1"
babel-runtime "^6.22.0"
babel-template "^6.24.1"
babel-traverse "^6.24.1"
babel-types "^6.24.1"
babel-helper-get-function-arity@^6.24.1:
version "6.24.1"
resolved "https://registry.yarnpkg.com/babel-helper-get-function-arity/-/babel-helper-get-function-arity-6.24.1.tgz#8f7782aa93407c41d3aa50908f89b031b1b6853d"
dependencies:
babel-runtime "^6.22.0"
babel-types "^6.24.1"
babel-helper-vue-jsx-merge-props@^2.0.2:
version "2.0.3"
resolved "https://registry.yarnpkg.com/babel-helper-vue-jsx-merge-props/-/babel-helper-vue-jsx-merge-props-2.0.3.tgz#22aebd3b33902328e513293a8e4992b384f9f1b6"
@ -1279,23 +1340,10 @@ babel-messages@^6.23.0:
dependencies:
babel-runtime "^6.22.0"
babel-plugin-syntax-class-properties@^6.8.0:
version "6.13.0"
resolved "http://registry.npmjs.org/babel-plugin-syntax-class-properties/-/babel-plugin-syntax-class-properties-6.13.0.tgz#d7eb23b79a317f8543962c505b827c7d6cac27de"
babel-plugin-syntax-flow@^6.18.0:
version "6.18.0"
resolved "http://registry.npmjs.org/babel-plugin-syntax-flow/-/babel-plugin-syntax-flow-6.18.0.tgz#4c3ab20a2af26aa20cd25995c398c4eb70310c8d"
babel-plugin-transform-class-properties@^6.24.1:
version "6.24.1"
resolved "https://registry.yarnpkg.com/babel-plugin-transform-class-properties/-/babel-plugin-transform-class-properties-6.24.1.tgz#6a79763ea61d33d36f37b611aa9def81a81b46ac"
dependencies:
babel-helper-function-name "^6.24.1"
babel-plugin-syntax-class-properties "^6.8.0"
babel-runtime "^6.22.0"
babel-template "^6.24.1"
babel-plugin-transform-flow-strip-types@^6.22.0:
version "6.22.0"
resolved "https://registry.yarnpkg.com/babel-plugin-transform-flow-strip-types/-/babel-plugin-transform-flow-strip-types-6.22.0.tgz#84cb672935d43714fdc32bce84568d87441cf7cf"
@ -1359,7 +1407,7 @@ babel-template@^6.24.1, babel-template@^6.26.0:
babylon "^6.18.0"
lodash "^4.17.4"
babel-traverse@^6.24.1, babel-traverse@^6.26.0:
babel-traverse@^6.26.0:
version "6.26.0"
resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-6.26.0.tgz#46a9cbd7edcc62c8e5c064e2d2d8d0f4035766ee"
dependencies:
@ -2442,6 +2490,12 @@ debug@^2.1.2, debug@^2.2.0, debug@^2.3.3, debug@^2.6.3, debug@^2.6.8, debug@^2.6
dependencies:
ms "2.0.0"
debug@^4.1.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/debug/-/debug-4.1.0.tgz#373687bffa678b38b1cd91f861b63850035ddc87"
dependencies:
ms "^2.1.1"
decamelize-keys@^1.0.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/decamelize-keys/-/decamelize-keys-1.1.0.tgz#d171a87933252807eb3cb61dc1c1445d078df2d9"
@ -3147,10 +3201,6 @@ flatten@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/flatten/-/flatten-1.0.2.tgz#dae46a9d78fbe25292258cc1e780a41d95c03782"
flow-bin@^0.81.0:
version "0.81.0"
resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.81.0.tgz#7f0a733dce1dad3cb1447c692639292dc3d60bf5"
flush-write-stream@^1.0.0:
version "1.0.3"
resolved "https://registry.yarnpkg.com/flush-write-stream/-/flush-write-stream-1.0.3.tgz#c5d586ef38af6097650b49bc41b55fabb19f35bd"
@ -4624,6 +4674,10 @@ ms@2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8"
ms@^2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.1.tgz#30a5864eb3ebb0a66f2ebe6d727af06a09d86e0a"
mute-stream@0.0.7:
version "0.0.7"
resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab"