Use eslint

Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
This commit is contained in:
John Molakvoæ (skjnldsv) 2019-09-25 09:55:33 +02:00
parent f9870eec2c
commit 7fb6512351
No known key found for this signature in database
GPG Key ID: 60C25B8C072916CF
5 changed files with 1404 additions and 204 deletions

12
.eslintrc.js Normal file
View File

@ -0,0 +1,12 @@
module.exports = {
globals: {
__webpack_nonce__: true,
__webpack_public_path__: true,
_: true,
$: true,
moment: true,
escapeHTML: true,
oc_userconfig: true
},
extends: ['nextcloud']
}

View File

@ -1,6 +1,7 @@
all: clean dev-setup build-js-production
dev-setup: clean-dev npm-init
# Dev env management
dev-setup: clean clean-dev npm-init
npm-init:
npm install
@ -8,6 +9,7 @@ npm-init:
npm-update:
npm update
# Building
build-js:
npm run dev
@ -17,9 +19,11 @@ build-js-production:
watch-js:
npm run watch
clean-dev:
rm -rf node_modules
# Linting
lint-fix:
npm run lint:fix
# Cleaning
clean:
rm -rf apps/accessibility/js/
rm -rf apps/comments/js/
@ -27,12 +31,15 @@ clean:
rm -rf apps/files_trashbin/js/
rm -rf apps/files_versions/js/
rm -rf apps/oauth2/js/
rm -rf apps/settings/js/vue-*
rm -rf apps/systemtags/js/systemtags.*
rm -rf apps/twofactor_backupcodes/js
rm -rf apps/updatenotification/js/updatenotification.*
rm -rf apps/workflowengine/js/
rm -rf core/js/dist
rm -rf settings/js/vue-*
clean-dev:
rm -rf node_modules
clean-git: clean
git checkout -- apps/accessibility/js/
@ -41,9 +48,9 @@ clean-git: clean
git checkout -- apps/files_trashbin/js/
git checkout -- apps/files_versions/js/
git checkout -- apps/oauth2/js/
git checkout -- apps/settings/js/vue-*
git checkout -- apps/systemtags/js/systemtags.*
git checkout -- apps/twofactor_backupcodes/js
git checkout -- apps/updatenotification/js/updatenotification.*
git checkout -- apps/workflowengine/js/
git checkout -- core/js/dist
git checkout -- settings/js/vue-*

1419
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -9,8 +9,9 @@
},
"scripts": {
"build": "NODE_ENV=production webpack --progress --hide-modules --config webpack.prod.js",
"dev": "NODE_ENV=development webpack --progress --watch --config webpack.dev.js",
"watch": "NODE_ENV=development webpack --progress --watch --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",
"lint:fix": "ESLINT_FIX=true webpack --progress --watch --config webpack.dev.js"
},
"repository": {
"type": "git",
@ -72,6 +73,16 @@
"babel-plugin-transform-es2015-arrow-functions": "^6.22.0",
"browserslist-config-nextcloud": "0.0.1",
"css-loader": "^3.2.0",
"eslint": "^5.16.0",
"eslint-config-nextcloud": "0.0.5",
"eslint-config-standard": "^12.0.0",
"eslint-loader": "^3.0.0",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-nextcloud": "^0.3.0",
"eslint-plugin-node": "^10.0.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.1",
"eslint-plugin-vue": "^5.2.3",
"exports-loader": "^0.7.0",
"file-loader": "^4.2.0",
"handlebars-loader": "^1.7.1",

View File

@ -1,20 +1,21 @@
const path = require('path');
const merge = require('webpack-merge');
const { VueLoaderPlugin } = require('vue-loader');
/* eslint-disable camelcase */
const path = require('path')
const merge = require('webpack-merge')
const { VueLoaderPlugin } = require('vue-loader')
const core = require('./core/webpack');
const accessibility = require('./apps/accessibility/webpack');
const core = require('./core/webpack')
const comments = require('./apps/comments/webpack');
const files_sharing = require('./apps/files_sharing/webpack');
const files_trashbin = require('./apps/files_trashbin/webpack');
const files_versions = require('./apps/files_versions/webpack');
const oauth2 = require('./apps/oauth2/webpack');
const systemtags = require('./apps/systemtags/webpack');
const settings = require('./apps/settings/webpack');
const twofactor_backupscodes = require('./apps/twofactor_backupcodes/webpack');
const updatenotifications = require('./apps/updatenotification/webpack');
const workflowengine = require('./apps/workflowengine/webpack');
const accessibility = require('./apps/accessibility/webpack')
const comments = require('./apps/comments/webpack')
const files_sharing = require('./apps/files_sharing/webpack')
const files_trashbin = require('./apps/files_trashbin/webpack')
const files_versions = require('./apps/files_versions/webpack')
const oauth2 = require('./apps/oauth2/webpack')
const settings = require('./apps/settings/webpack')
const systemtags = require('./apps/systemtags/webpack')
const twofactor_backupscodes = require('./apps/twofactor_backupcodes/webpack')
const updatenotifications = require('./apps/updatenotification/webpack')
const workflowengine = require('./apps/workflowengine/webpack')
module.exports = []
.concat(
@ -31,55 +32,67 @@ module.exports = []
updatenotifications,
workflowengine
)
.map(config =>
merge.smart({
module: {
rules: [
{
test: /\.css$/,
use: ['style-loader', 'css-loader']
},
{
test: /\.scss$/,
use: ['style-loader', 'css-loader', 'sass-loader']
},
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/
},
{
test: /\.vue$/,
loader: 'vue-loader'
},
{
test: /\.(png|jpg|gif)$/,
loader: 'url-loader',
options: {
name: '[name].[ext]?[hash]',
limit: 8192
}
},
{
test: /\.handlebars/,
loader: "handlebars-loader",
query: {
extensions: '.handlebars'
}
}
]
},
plugins: [
new VueLoaderPlugin()
],
resolve: {
alias: {
OC: path.resolve(__dirname, './core/src/OC'),
OCA: path.resolve(__dirname, './core/src/OCA'),
// make sure to use the handlebar runtime when importing
handlebars: 'handlebars/runtime'
.map(config => merge.smart({
module: {
rules: [
{
test: /\.css$/,
use: ['vue-style-loader', 'css-loader']
},
extensions: ['*', '.js', '.vue', '.json']
}
}, config)
);
{
test: /\.scss$/,
use: ['vue-style-loader', 'css-loader', 'sass-loader']
},
{
test: /\.(js|vue)$/,
loader: 'eslint-loader',
// no checks against vendors, modules or handlebar compiled files
exclude: /node_modules|vendor|templates\.js/,
enforce: 'pre',
options: {
// we cannot simply use the eslint binary as we
// don't want to parse all the js files so let's
// use it from within webpack and only check
// against our compiled files
fix: process.env.ESLINT_FIX === 'true'
}
},
{
test: /\.vue$/,
loader: 'vue-loader',
exclude: /node_modules/
},
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/
},
{
test: /\.(png|jpg|gif)$/,
loader: 'url-loader',
options: {
name: '[name].[ext]?[hash]',
limit: 8192
}
},
{
test: /\.handlebars/,
loader: 'handlebars-loader',
query: {
extensions: '.handlebars'
}
}
]
},
plugins: [new VueLoaderPlugin()],
resolve: {
alias: {
OC: path.resolve(__dirname, './core/src/OC'),
OCA: path.resolve(__dirname, './core/src/OCA'),
// make sure to use the handlebar runtime when importing
handlebars: 'handlebars/runtime'
},
extensions: ['*', '.js', '.vue']
}
}, config))