Skip to content

Commit

Permalink
chore: add editor config
Browse files Browse the repository at this point in the history
chore: reuse commands
  • Loading branch information
saw-jan committed Jan 13, 2025
1 parent e15554b commit e2e0cea
Show file tree
Hide file tree
Showing 10 changed files with 70 additions and 30 deletions.
23 changes: 23 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = tab
indent_size = 4
trim_trailing_whitespace = true

[package*.json]
indent_size = 2
indent_style = space

[*.md]
trim_trailing_whitespace = false

[*.svg]
insert_final_newline = false

[*.{yml,yaml}]
indent_size = 2
indent_style = space
14 changes: 7 additions & 7 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
module.exports = {
globals: {
appVersion: true
appVersion: true,
},
parserOptions: {
requireConfigFile: false
requireConfigFile: false,
},
extends: [
'@nextcloud'
],
extends: ['@nextcloud'],
rules: {
'jsdoc/require-jsdoc': 'off',
'jsdoc/tag-lines': 'off',
'vue/first-attribute-linebreak': 'off',
'import/extensions': 'off'
}
'import/extensions': 'off',
'max-len': ['error', { code: 120 }],
},
ignorePatterns: ['node_modules/*', 'js/*', 'vendor/*', 'dev/apps/*', 'l10n/*'],
}
4 changes: 1 addition & 3 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
const path = require('path')
const rootDir = path.resolve(__dirname, '../../../')

module.exports = {
testMatch: ['**/tests/**/*.spec.{js,ts}'],
moduleNameMapper: {
Expand All @@ -10,6 +7,7 @@ module.exports = {
transform: {
// process *.vue files with vue-jest
'\\.vue$': '@vue/vue2-jest',
// eslint-disable-next-line max-len
'.+\\.(css|styl|less|sass|scss|jpg|jpeg|png|svg|gif|eot|otf|webp|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga|avif)$':
'jest-transform-stub',
'\\.c?js$': 'babel-jest',
Expand Down
15 changes: 8 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
"scripts": {
"build": "NODE_ENV=production webpack --progress --config webpack.js",
"dev": "NODE_ENV=development webpack --progress --config webpack.js",
"watch": "NODE_ENV=development webpack --progress --watch --config webpack.js",
"watch": "npm run dev -- --watch",
"lint": "eslint --ext .js,.vue src tests",
"lint:fix": "eslint --ext .js,.vue src tests --fix",
"lint:fix": "npm run lint -- --fix",
"stylelint": "stylelint css src",
"stylelint:fix": "stylelint css src --fix",
"stylelint:fix": "npm run stylelint -- --fix",
"test:unit": "jest --silent",
"test:unit:watch": "jest --watch --no-coverage"
},
Expand Down Expand Up @@ -63,12 +63,13 @@
"@nextcloud/webpack-vue-config": "^6.0.1",
"@vue/test-utils": "^1.3.6",
"@vue/vue2-jest": "^29.2.6",
"eslint-webpack-plugin": "^4.2.0",
"stylelint-webpack-plugin": "^5.0.1",
"vue-template-compiler": "^2.7.16",
"babel-jest": "^29.0.0",
"eslint-webpack-plugin": "^4.2.0",
"jest-environment-jsdom": "^29.7.0",
"jest-transform-stub": "^2.0.0",
"vue-loader": "^15.11.1"
"prettier": "^3.4.2",
"stylelint-webpack-plugin": "^5.0.1",
"vue-loader": "^15.11.1",
"vue-template-compiler": "^2.7.16"
}
}
4 changes: 2 additions & 2 deletions src/adminSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ import Vue from 'vue'
import './bootstrap.js'
import AdminSettings from './components/AdminSettings.vue'

// eslint-disable-next-line
// eslint-disable-next-line no-unused-expressions
'use strict'

// eslint-disable-next-line
// eslint-disable-next-line no-new
new Vue({
el: '#openproject_prefs',
render: h => h(AdminSettings),
Expand Down
4 changes: 2 additions & 2 deletions src/personalSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ import Vue from 'vue'
import './bootstrap.js'
import PersonalSettings from './components/PersonalSettings.vue'

// eslint-disable-next-line
// eslint-disable-next-line no-unused-expressions
'use strict'

// eslint-disable-next-line
// eslint-disable-next-line no-new
new Vue({
el: '#openproject_prefs',
render: h => h(PersonalSettings),
Expand Down
7 changes: 5 additions & 2 deletions src/reference.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ __webpack_public_path__ = OC.linkTo('integration_openproject', 'js/') // eslint-
registerWidget('integration_openproject_work_package', async (el, { richObjectType, richObject, accessible }) => {
// here we lazy load the components so it does not slow down the initial page load
const { default: Vue } = await import(/* webpackChunkName: "reference-wp-lazy" */'vue')
const { default: WorkPackageReferenceWidget } = await import(/* webpackChunkName: "reference-wp-lazy" */'./views/WorkPackageReferenceWidget.vue')
const { default: WorkPackageReferenceWidget } = await import(
/* webpackChunkName: "reference-wp-lazy" */'./views/WorkPackageReferenceWidget.vue'
)
Vue.mixin({ methods: { t, n } })
const Widget = Vue.extend(WorkPackageReferenceWidget)
new Widget({
Expand All @@ -44,7 +46,8 @@ registerWidget('integration_openproject_work_package', async (el, { richObjectTy

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

const Element = Vue.extend(WorkPackagePickerElement)
Expand Down
10 changes: 8 additions & 2 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,14 @@ export const WORKPACKAGES_SEARCH_ORIGIN = {
LINK_MULTIPLE_FILES_MODAL: 'link-multiple-files-modal',
}
export const USER_SETTINGS = {
NAVIGATION_LINK_DESCRIPTION: t('integration_openproject', 'Displays a link to your OpenProject instance in the Nextcloud header.'),
UNIFIED_SEARCH_DESCRIPTION: t('integration_openproject', 'Allows you to search OpenProject work packages via the universal search bar in Nextcloud.'),
NAVIGATION_LINK_DESCRIPTION: t(
'integration_openproject',
'Displays a link to your OpenProject instance in the Nextcloud header.',
),
UNIFIED_SEARCH_DESCRIPTION: t(
'integration_openproject',
'Allows you to search OpenProject work packages via the universal search bar in Nextcloud.',
),
}

export const NO_OPTION_TEXT_STATE = {
Expand Down
2 changes: 1 addition & 1 deletion stylelint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ stylelintConfig.rules = {
...stylelintConfig.rules,
'declaration-colon-space-after': 'always',
'max-empty-lines': 1,
"block-opening-brace-space-before": "always"
'block-opening-brace-space-before': 'always',
}
module.exports = stylelintConfig
17 changes: 13 additions & 4 deletions webpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,22 @@ webpackConfig.stats = {

const appId = 'integration_openproject'
webpackConfig.entry = {
personalSettings: { import: path.join(__dirname, 'src', 'personalSettings.js'), filename: appId + '-personalSettings.js' },
personalSettings: {
import: path.join(__dirname, 'src', 'personalSettings.js'),
filename: appId + '-personalSettings.js',
},
adminSettings: { import: path.join(__dirname, 'src', 'adminSettings.js'), filename: appId + '-adminSettings.js' },
dashboard: { import: path.join(__dirname, 'src', 'dashboard.js'), filename: appId + '-dashboard.js' },
'openproject-tab': { import: path.join(__dirname, 'src', 'projectTab.js'), filename: appId + '-projectTab.js' },
fileActions: { import: path.join(__dirname, 'src', 'fileActions.js'), filename: appId + '-fileActions.js' },
filesPlugin: { import: path.join(__dirname, 'src/filesPlugin', 'filesPlugin'), filename: appId + '-filesPlugin.js' },
filesPluginLessThan28: { import: path.join(__dirname, 'src/filesPlugin', 'filesPluginLessThan28.js'), filename: appId + '-filesPluginLessThan28.js' },
filesPlugin: {
import: path.join(__dirname, 'src/filesPlugin', 'filesPlugin'),
filename: appId + '-filesPlugin.js',
},
filesPluginLessThan28: {
import: path.join(__dirname, 'src/filesPlugin', 'filesPluginLessThan28.js'),
filename: appId + '-filesPluginLessThan28.js',
},
reference: { import: path.join(__dirname, 'src', 'reference.js'), filename: appId + '-reference.js' },
}

Expand All @@ -29,7 +38,7 @@ webpackConfig.plugins.push(
extensions: ['js', 'vue'],
files: 'src',
failOnError: !isDev,
})
}),
)
webpackConfig.plugins.push(
new StyleLintPlugin({
Expand Down

0 comments on commit e2e0cea

Please sign in to comment.