Skip to content

Commit bc8766d

Browse files
committed
chore: add editor config
chore: reuse commands
1 parent e15554b commit bc8766d

File tree

10 files changed

+65
-26
lines changed

10 files changed

+65
-26
lines changed

.editorconfig

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
indent_style = tab
8+
indent_size = 4
9+
trim_trailing_whitespace = true
10+
11+
[package*.json]
12+
indent_size = 2
13+
indent_style = space
14+
15+
[*.md]
16+
trim_trailing_whitespace = false
17+
18+
[*.svg]
19+
insert_final_newline = false
20+
21+
[*.{yml,yaml}]
22+
indent_size = 2
23+
indent_style = space

.eslintrc.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
module.exports = {
22
globals: {
3-
appVersion: true
3+
appVersion: true,
44
},
55
parserOptions: {
6-
requireConfigFile: false
6+
requireConfigFile: false,
77
},
8-
extends: [
9-
'@nextcloud'
10-
],
8+
extends: ['@nextcloud'],
119
rules: {
1210
'jsdoc/require-jsdoc': 'off',
1311
'jsdoc/tag-lines': 'off',
1412
'vue/first-attribute-linebreak': 'off',
15-
'import/extensions': 'off'
16-
}
13+
'import/extensions': 'off',
14+
'max-len': ['error', { code: 120 }],
15+
},
16+
ignorePatterns: ['node_modules/*', 'js/*', 'vendor/*', 'dev/apps/*', 'l10n/*'],
1717
}

jest.config.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
const path = require('path')
2-
const rootDir = path.resolve(__dirname, '../../../')
3-
41
module.exports = {
52
testMatch: ['**/tests/**/*.spec.{js,ts}'],
63
moduleNameMapper: {
@@ -10,6 +7,7 @@ module.exports = {
107
transform: {
118
// process *.vue files with vue-jest
129
'\\.vue$': '@vue/vue2-jest',
10+
// eslint-disable-next-line max-len
1311
'.+\\.(css|styl|less|sass|scss|jpg|jpeg|png|svg|gif|eot|otf|webp|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga|avif)$':
1412
'jest-transform-stub',
1513
'\\.c?js$': 'babel-jest',

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
"scripts": {
1010
"build": "NODE_ENV=production webpack --progress --config webpack.js",
1111
"dev": "NODE_ENV=development webpack --progress --config webpack.js",
12-
"watch": "NODE_ENV=development webpack --progress --watch --config webpack.js",
12+
"watch": "npm run dev -- --watch",
1313
"lint": "eslint --ext .js,.vue src tests",
14-
"lint:fix": "eslint --ext .js,.vue src tests --fix",
14+
"lint:fix": "npm run lint -- --fix",
1515
"stylelint": "stylelint css src",
16-
"stylelint:fix": "stylelint css src --fix",
16+
"stylelint:fix": "npm run stylelint -- --fix",
1717
"test:unit": "jest --silent",
1818
"test:unit:watch": "jest --watch --no-coverage"
1919
},

src/adminSettings.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ import Vue from 'vue'
1515
import './bootstrap.js'
1616
import AdminSettings from './components/AdminSettings.vue'
1717

18-
// eslint-disable-next-line
18+
// eslint-disable-next-line no-unused-expressions
1919
'use strict'
2020

21-
// eslint-disable-next-line
21+
// eslint-disable-next-line no-new
2222
new Vue({
2323
el: '#openproject_prefs',
2424
render: h => h(AdminSettings),

src/personalSettings.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ import Vue from 'vue'
1515
import './bootstrap.js'
1616
import PersonalSettings from './components/PersonalSettings.vue'
1717

18-
// eslint-disable-next-line
18+
// eslint-disable-next-line no-unused-expressions
1919
'use strict'
2020

21-
// eslint-disable-next-line
21+
// eslint-disable-next-line no-new
2222
new Vue({
2323
el: '#openproject_prefs',
2424
render: h => h(PersonalSettings),

src/reference.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ __webpack_public_path__ = OC.linkTo('integration_openproject', 'js/') // eslint-
3030
registerWidget('integration_openproject_work_package', async (el, { richObjectType, richObject, accessible }) => {
3131
// here we lazy load the components so it does not slow down the initial page load
3232
const { default: Vue } = await import(/* webpackChunkName: "reference-wp-lazy" */'vue')
33-
const { default: WorkPackageReferenceWidget } = await import(/* webpackChunkName: "reference-wp-lazy" */'./views/WorkPackageReferenceWidget.vue')
33+
const { default: WorkPackageReferenceWidget } = await import(
34+
/* webpackChunkName: "reference-wp-lazy" */'./views/WorkPackageReferenceWidget.vue'
35+
)
3436
Vue.mixin({ methods: { t, n } })
3537
const Widget = Vue.extend(WorkPackageReferenceWidget)
3638
new Widget({
@@ -44,7 +46,8 @@ registerWidget('integration_openproject_work_package', async (el, { richObjectTy
4446

4547
registerCustomPickerElement('openproject-work-package-ref', async (el, { providerId, accessible }) => {
4648
const { default: Vue } = await import(/* webpackChunkName: "reference-picker-lazy" */'vue')
47-
const { default: WorkPackagePickerElement } = await import(/* webpackChunkName: "reference-picker-lazy" */'./views/WorkPackagePickerElement.vue')
49+
const { default: WorkPackagePickerElement } = await import(
50+
/* webpackChunkName: "reference-picker-lazy" */'./views/WorkPackagePickerElement.vue')
4851
Vue.mixin({ methods: { t, n } })
4952

5053
const Element = Vue.extend(WorkPackagePickerElement)

src/utils.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,14 @@ export const WORKPACKAGES_SEARCH_ORIGIN = {
5656
LINK_MULTIPLE_FILES_MODAL: 'link-multiple-files-modal',
5757
}
5858
export const USER_SETTINGS = {
59-
NAVIGATION_LINK_DESCRIPTION: t('integration_openproject', 'Displays a link to your OpenProject instance in the Nextcloud header.'),
60-
UNIFIED_SEARCH_DESCRIPTION: t('integration_openproject', 'Allows you to search OpenProject work packages via the universal search bar in Nextcloud.'),
59+
NAVIGATION_LINK_DESCRIPTION: t(
60+
'integration_openproject',
61+
'Displays a link to your OpenProject instance in the Nextcloud header.',
62+
),
63+
UNIFIED_SEARCH_DESCRIPTION: t(
64+
'integration_openproject',
65+
'Allows you to search OpenProject work packages via the universal search bar in Nextcloud.',
66+
),
6167
}
6268

6369
export const NO_OPTION_TEXT_STATE = {

stylelint.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ stylelintConfig.rules = {
33
...stylelintConfig.rules,
44
'declaration-colon-space-after': 'always',
55
'max-empty-lines': 1,
6-
"block-opening-brace-space-before": "always"
6+
'block-opening-brace-space-before': 'always',
77
}
88
module.exports = stylelintConfig

webpack.js

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,22 @@ webpackConfig.stats = {
1414

1515
const appId = 'integration_openproject'
1616
webpackConfig.entry = {
17-
personalSettings: { import: path.join(__dirname, 'src', 'personalSettings.js'), filename: appId + '-personalSettings.js' },
17+
personalSettings: {
18+
import: path.join(__dirname, 'src', 'personalSettings.js'),
19+
filename: appId + '-personalSettings.js',
20+
},
1821
adminSettings: { import: path.join(__dirname, 'src', 'adminSettings.js'), filename: appId + '-adminSettings.js' },
1922
dashboard: { import: path.join(__dirname, 'src', 'dashboard.js'), filename: appId + '-dashboard.js' },
2023
'openproject-tab': { import: path.join(__dirname, 'src', 'projectTab.js'), filename: appId + '-projectTab.js' },
2124
fileActions: { import: path.join(__dirname, 'src', 'fileActions.js'), filename: appId + '-fileActions.js' },
22-
filesPlugin: { import: path.join(__dirname, 'src/filesPlugin', 'filesPlugin'), filename: appId + '-filesPlugin.js' },
23-
filesPluginLessThan28: { import: path.join(__dirname, 'src/filesPlugin', 'filesPluginLessThan28.js'), filename: appId + '-filesPluginLessThan28.js' },
25+
filesPlugin: {
26+
import: path.join(__dirname, 'src/filesPlugin', 'filesPlugin'),
27+
filename: appId + '-filesPlugin.js',
28+
},
29+
filesPluginLessThan28: {
30+
import: path.join(__dirname, 'src/filesPlugin', 'filesPluginLessThan28.js'),
31+
filename: appId + '-filesPluginLessThan28.js',
32+
},
2433
reference: { import: path.join(__dirname, 'src', 'reference.js'), filename: appId + '-reference.js' },
2534
}
2635

@@ -29,7 +38,7 @@ webpackConfig.plugins.push(
2938
extensions: ['js', 'vue'],
3039
files: 'src',
3140
failOnError: !isDev,
32-
})
41+
}),
3342
)
3443
webpackConfig.plugins.push(
3544
new StyleLintPlugin({

0 commit comments

Comments
 (0)