Use eslint
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
This commit is contained in:
parent
f9870eec2c
commit
7fb6512351
5 changed files with 1404 additions and 204 deletions
12
.eslintrc.js
Normal file
12
.eslintrc.js
Normal 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']
|
||||||
|
}
|
17
Makefile
17
Makefile
|
@ -1,6 +1,7 @@
|
||||||
all: clean dev-setup build-js-production
|
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-init:
|
||||||
npm install
|
npm install
|
||||||
|
@ -8,6 +9,7 @@ npm-init:
|
||||||
npm-update:
|
npm-update:
|
||||||
npm update
|
npm update
|
||||||
|
|
||||||
|
# Building
|
||||||
build-js:
|
build-js:
|
||||||
npm run dev
|
npm run dev
|
||||||
|
|
||||||
|
@ -17,9 +19,11 @@ build-js-production:
|
||||||
watch-js:
|
watch-js:
|
||||||
npm run watch
|
npm run watch
|
||||||
|
|
||||||
clean-dev:
|
# Linting
|
||||||
rm -rf node_modules
|
lint-fix:
|
||||||
|
npm run lint:fix
|
||||||
|
|
||||||
|
# Cleaning
|
||||||
clean:
|
clean:
|
||||||
rm -rf apps/accessibility/js/
|
rm -rf apps/accessibility/js/
|
||||||
rm -rf apps/comments/js/
|
rm -rf apps/comments/js/
|
||||||
|
@ -27,12 +31,15 @@ clean:
|
||||||
rm -rf apps/files_trashbin/js/
|
rm -rf apps/files_trashbin/js/
|
||||||
rm -rf apps/files_versions/js/
|
rm -rf apps/files_versions/js/
|
||||||
rm -rf apps/oauth2/js/
|
rm -rf apps/oauth2/js/
|
||||||
|
rm -rf apps/settings/js/vue-*
|
||||||
rm -rf apps/systemtags/js/systemtags.*
|
rm -rf apps/systemtags/js/systemtags.*
|
||||||
rm -rf apps/twofactor_backupcodes/js
|
rm -rf apps/twofactor_backupcodes/js
|
||||||
rm -rf apps/updatenotification/js/updatenotification.*
|
rm -rf apps/updatenotification/js/updatenotification.*
|
||||||
rm -rf apps/workflowengine/js/
|
rm -rf apps/workflowengine/js/
|
||||||
rm -rf core/js/dist
|
rm -rf core/js/dist
|
||||||
rm -rf settings/js/vue-*
|
|
||||||
|
clean-dev:
|
||||||
|
rm -rf node_modules
|
||||||
|
|
||||||
clean-git: clean
|
clean-git: clean
|
||||||
git checkout -- apps/accessibility/js/
|
git checkout -- apps/accessibility/js/
|
||||||
|
@ -41,9 +48,9 @@ clean-git: clean
|
||||||
git checkout -- apps/files_trashbin/js/
|
git checkout -- apps/files_trashbin/js/
|
||||||
git checkout -- apps/files_versions/js/
|
git checkout -- apps/files_versions/js/
|
||||||
git checkout -- apps/oauth2/js/
|
git checkout -- apps/oauth2/js/
|
||||||
|
git checkout -- apps/settings/js/vue-*
|
||||||
git checkout -- apps/systemtags/js/systemtags.*
|
git checkout -- apps/systemtags/js/systemtags.*
|
||||||
git checkout -- apps/twofactor_backupcodes/js
|
git checkout -- apps/twofactor_backupcodes/js
|
||||||
git checkout -- apps/updatenotification/js/updatenotification.*
|
git checkout -- apps/updatenotification/js/updatenotification.*
|
||||||
git checkout -- apps/workflowengine/js/
|
git checkout -- apps/workflowengine/js/
|
||||||
git checkout -- core/js/dist
|
git checkout -- core/js/dist
|
||||||
git checkout -- settings/js/vue-*
|
|
||||||
|
|
1419
package-lock.json
generated
1419
package-lock.json
generated
File diff suppressed because it is too large
Load diff
15
package.json
15
package.json
|
@ -9,8 +9,9 @@
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"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 --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"
|
"watch": "NODE_ENV=development webpack --progress --watch --config webpack.dev.js",
|
||||||
|
"lint:fix": "ESLINT_FIX=true webpack --progress --watch --config webpack.dev.js"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
@ -72,6 +73,16 @@
|
||||||
"babel-plugin-transform-es2015-arrow-functions": "^6.22.0",
|
"babel-plugin-transform-es2015-arrow-functions": "^6.22.0",
|
||||||
"browserslist-config-nextcloud": "0.0.1",
|
"browserslist-config-nextcloud": "0.0.1",
|
||||||
"css-loader": "^3.2.0",
|
"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",
|
"exports-loader": "^0.7.0",
|
||||||
"file-loader": "^4.2.0",
|
"file-loader": "^4.2.0",
|
||||||
"handlebars-loader": "^1.7.1",
|
"handlebars-loader": "^1.7.1",
|
||||||
|
|
|
@ -1,20 +1,21 @@
|
||||||
const path = require('path');
|
/* eslint-disable camelcase */
|
||||||
const merge = require('webpack-merge');
|
const path = require('path')
|
||||||
const { VueLoaderPlugin } = require('vue-loader');
|
const merge = require('webpack-merge')
|
||||||
|
const { VueLoaderPlugin } = require('vue-loader')
|
||||||
|
|
||||||
const core = require('./core/webpack');
|
const core = require('./core/webpack')
|
||||||
const accessibility = require('./apps/accessibility/webpack');
|
|
||||||
|
|
||||||
const comments = require('./apps/comments/webpack');
|
const accessibility = require('./apps/accessibility/webpack')
|
||||||
const files_sharing = require('./apps/files_sharing/webpack');
|
const comments = require('./apps/comments/webpack')
|
||||||
const files_trashbin = require('./apps/files_trashbin/webpack');
|
const files_sharing = require('./apps/files_sharing/webpack')
|
||||||
const files_versions = require('./apps/files_versions/webpack');
|
const files_trashbin = require('./apps/files_trashbin/webpack')
|
||||||
const oauth2 = require('./apps/oauth2/webpack');
|
const files_versions = require('./apps/files_versions/webpack')
|
||||||
const systemtags = require('./apps/systemtags/webpack');
|
const oauth2 = require('./apps/oauth2/webpack')
|
||||||
const settings = require('./apps/settings/webpack');
|
const settings = require('./apps/settings/webpack')
|
||||||
const twofactor_backupscodes = require('./apps/twofactor_backupcodes/webpack');
|
const systemtags = require('./apps/systemtags/webpack')
|
||||||
const updatenotifications = require('./apps/updatenotification/webpack');
|
const twofactor_backupscodes = require('./apps/twofactor_backupcodes/webpack')
|
||||||
const workflowengine = require('./apps/workflowengine/webpack');
|
const updatenotifications = require('./apps/updatenotification/webpack')
|
||||||
|
const workflowengine = require('./apps/workflowengine/webpack')
|
||||||
|
|
||||||
module.exports = []
|
module.exports = []
|
||||||
.concat(
|
.concat(
|
||||||
|
@ -31,55 +32,67 @@ module.exports = []
|
||||||
updatenotifications,
|
updatenotifications,
|
||||||
workflowengine
|
workflowengine
|
||||||
)
|
)
|
||||||
.map(config =>
|
.map(config => merge.smart({
|
||||||
merge.smart({
|
module: {
|
||||||
module: {
|
rules: [
|
||||||
rules: [
|
{
|
||||||
{
|
test: /\.css$/,
|
||||||
test: /\.css$/,
|
use: ['vue-style-loader', 'css-loader']
|
||||||
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'
|
|
||||||
},
|
},
|
||||||
extensions: ['*', '.js', '.vue', '.json']
|
{
|
||||||
}
|
test: /\.scss$/,
|
||||||
}, config)
|
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))
|
||||||
|
|
Loading…
Reference in a new issue