Skip to content

Commit cc7f7d7

Browse files
committed
Remove flow defs and usage, will be using TS
1 parent 8fd0e5f commit cc7f7d7

File tree

10 files changed

+110
-88
lines changed

10 files changed

+110
-88
lines changed

.babelrc

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
],
55
"plugins": [
66
["@babel/plugin-proposal-object-rest-spread", { "useBuiltIns": true }],
7-
"babel-plugin-transform-class-properties",
8-
"babel-plugin-syntax-flow",
9-
"babel-plugin-transform-flow-strip-types"
7+
"@babel/plugin-proposal-class-properties"
108
]
119
}

.eslintrc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
{
22
"parser": "babel-eslint",
3-
"plugins": ["html", "flowtype-errors"],
3+
"plugins": ["html"],
44
"extends": ["vue"],
55
"rules": {
6-
"flowtype-errors/show-errors": 2,
76
"semi": "off",
87
"indent": ["error", 4],
98
"comma-dangle": ["error", "always-multiline"],

.flowconfig

Lines changed: 0 additions & 14 deletions
This file was deleted.

package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
},
1616
"devDependencies": {
1717
"@babel/core": "^7.0.0-beta.49",
18+
"@babel/plugin-proposal-class-properties": "^7.2.1",
1819
"@babel/plugin-proposal-object-rest-spread": "^7.0.0-beta.49",
1920
"@babel/plugin-transform-async-to-generator": "^7.0.0-beta.49",
2021
"@babel/plugin-transform-runtime": "^7.0.0-beta.49",
@@ -25,8 +26,6 @@
2526
"babel-core": "^6.26.3",
2627
"babel-eslint": "^9.0.0",
2728
"babel-loader": "^8.0.0-beta.3",
28-
"babel-plugin-syntax-flow": "^6.18.0",
29-
"babel-plugin-transform-class-properties": "^6.24.1",
3029
"babel-plugin-transform-flow-strip-types": "^6.22.0",
3130
"babel-plugin-transform-object-assign": "^6.22.0",
3231
"babel-plugin-transform-runtime": "^6.23.0",
@@ -41,7 +40,6 @@
4140
"eslint-plugin-html": "^4.0.6",
4241
"eslint-plugin-vue": "^4.7.1",
4342
"extract-text-webpack-plugin": "^4.0.0-beta.0",
44-
"flow-bin": "^0.81.0",
4543
"glob-all": "^3.1.0",
4644
"html-webpack-plugin": "^3.2.0",
4745
"jquery": "^3.3.1",

resources/assets/scripts/api/http.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
// @flow
21
import axios from 'axios';
3-
import type { AxiosInstance } from 'axios';
42

53
// This token is set in the bootstrap.js file at the beginning of the request
64
// and is carried through from there.
75
// const token: string = '';
86

9-
const http: AxiosInstance = axios.create({
7+
const http = axios.create({
108
'X-Requested-With': 'XMLHttpRequest',
119
'Accept': 'application/json',
1210
'Content-Type': 'application/json',

resources/assets/scripts/api/server/getDirectoryContents.js

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,16 @@
1-
// @flow
21
import http from './../http';
32
import filter from 'lodash/filter';
43
import isObject from 'lodash/isObject';
54
import route from '../../../../../vendor/tightenco/ziggy/src/js/route';
65

7-
export interface DirectoryContentsResponse {
8-
files: Object,
9-
directories: Object,
10-
editable: Array<string>,
11-
}
12-
136
/**
147
* Get the contents of a specific directory for a given server.
158
*
169
* @param {String} server
1710
* @param {String} directory
18-
* @return {Promise<DirectoryContentsResponse>}
11+
* @return {Promise}
1912
*/
20-
export function getDirectoryContents(server: string, directory: string): Promise<DirectoryContentsResponse> {
13+
export function getDirectoryContents (server, directory) {
2114
return new Promise((resolve, reject) => {
2215
http.get(route('server.files', { server, directory }))
2316
.then((response) => {

resources/assets/scripts/app.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// @flow
21
import Vue from 'vue';
32
import Vuex from 'vuex';
43
import vuexI18n from 'vuex-i18n';

resources/assets/scripts/components/server/subpages/FileManager.vue

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,11 @@
4242
</template>
4343

4444
<script>
45-
// @flow
4645
import map from 'lodash/map';
4746
import { mapState } from 'vuex';
48-
import type { Route } from 'vue-router';
4947
import FileManagerFileRow from '../components/filemanager/FileManagerFileRow';
5048
import FileManagerFolderRow from '../components/filemanager/FileManagerFolderRow';
51-
import { getDirectoryContents, DirectoryContentsResponse } from '../../../api/server/getDirectoryContents';
49+
import { getDirectoryContents } from '../../../api/server/getDirectoryContents';
5250
5351
export default {
5452
name: 'file-manager-page',
@@ -62,13 +60,13 @@ export default {
6260
* Configure the breadcrumbs that display on the filemanager based on the directory that the
6361
* user is currently in.
6462
*/
65-
breadcrumbs: function (): Array<Object> {
66-
const directories: Array<string> = this.currentDirectory.replace(/^\/|\/$/, '').split('/');
63+
breadcrumbs: function () {
64+
const directories = this.currentDirectory.replace(/^\/|\/$/, '').split('/');
6765
if (directories.length < 1 || !directories[0]) {
6866
return [];
6967
}
7068
71-
return map(directories, function (value: string, key: number) {
69+
return map(directories, function (value, key) {
7270
if (key === directories.length - 1) {
7371
return { directoryName: value };
7472
}
@@ -85,22 +83,22 @@ export default {
8583
/**
8684
* When the route changes reload the directory.
8785
*/
88-
'$route': function (to: Route) {
86+
'$route': function (to) {
8987
this.currentDirectory = to.params.path || '/';
9088
},
9189
9290
/**
9391
* Watch the current directory setting and when it changes update the file listing.
9492
*/
95-
currentDirectory: function (): void {
93+
currentDirectory: function () {
9694
this.listDirectory();
9795
},
9896
9997
/**
10098
* When we reconnect to the Daemon make sure we grab a listing of all of the files
10199
* so that the error message disappears and we then load in a fresh listing.
102100
*/
103-
connected: function (): void {
101+
connected: function () {
104102
if (this.connected) {
105103
this.listDirectory();
106104
}
@@ -127,18 +125,18 @@ export default {
127125
/**
128126
* List the contents of a directory.
129127
*/
130-
listDirectory: function (): void {
128+
listDirectory: function () {
131129
this.loading = true;
132130
133-
const directory: string = encodeURI(this.currentDirectory.replace(/^\/|\/$/, ''));
131+
const directory = encodeURI(this.currentDirectory.replace(/^\/|\/$/, ''));
134132
getDirectoryContents(this.$route.params.id, directory)
135-
.then((response: DirectoryContentsResponse) => {
133+
.then((response) => {
136134
this.files = response.files;
137135
this.directories = response.directories;
138136
this.editableFiles = response.editable;
139137
this.errorMessage = null;
140138
})
141-
.catch((err: string|Object) => {
139+
.catch((err) => {
142140
if (err instanceof String) {
143141
this.errorMessage = err;
144142
return;

resources/assets/scripts/helpers/index.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// @flow
21
import format from 'date-fns/format';
32

43
/**
@@ -8,13 +7,13 @@ import format from 'date-fns/format';
87
* @param {Number} bytes
98
* @return {String}
109
*/
11-
export function readableSize (bytes: number): string {
10+
export function readableSize (bytes) {
1211
if (Math.abs(bytes) < 1024) {
1312
return `${bytes} Bytes`;
1413
}
1514

16-
let u: number = -1;
17-
const units: Array<string> = ['KiB', 'MiB', 'GiB', 'TiB'];
15+
let u = -1;
16+
const units = ['KiB', 'MiB', 'GiB', 'TiB'];
1817

1918
do {
2019
bytes /= 1024;
@@ -30,6 +29,6 @@ export function readableSize (bytes: number): string {
3029
* @param {String} date
3130
* @return {String}
3231
*/
33-
export function formatDate (date: string): string {
32+
export function formatDate (date) {
3433
return format(date, 'MMM D, YYYY [at] HH:MM');
3534
}

0 commit comments

Comments
 (0)