Skip to content

Commit

Permalink
Merge pull request #903 from nextcloud/chore/nextcloud-eslint-and-babel
Browse files Browse the repository at this point in the history
chore: migrate to @nextcloud/eslint-config and @nextcloud/babel-config
  • Loading branch information
st3iny authored Jun 10, 2024
2 parents e25d395 + 0698199 commit 486fea8
Show file tree
Hide file tree
Showing 41 changed files with 4,463 additions and 2,677 deletions.
44 changes: 4 additions & 40 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,41 +1,5 @@
module.exports = {
root: true,
env: {
browser: true,
es6: true,
node: true
},
globals: {
dav: true
},
extends: ['eslint:recommended', 'plugin:node/recommended', 'standard'],
plugins: ['node'],
rules: {
// space before function ()
'space-before-function-paren': ['error', 'never'],
// curly braces always space
'object-curly-spacing': ['error', 'always'],
'array-bracket-spacing': ['error', 'never'],
// stay consistent with array brackets
'array-bracket-newline': ['error', 'consistent'],
// 1tbs brace style
'brace-style': 'error',
// tabs only
indent: ['error', 'tab'],
'no-tabs': 0,
// only debug console
'no-console': ['error', { allow: ['error', 'warn', 'debug'] }],
// classes blocks
'padded-blocks': ['error', { classes: 'always' }],
// always have the operator in front
'operator-linebreak': ['error', 'before'],
// ternary on multiline
'multiline-ternary': ['error', 'always-multiline'],
// es6 import/export and require
'node/no-unsupported-features/es-syntax': ['off'],
// disable the recommended no-extra-semi
semi: ['error', 'always'],
// dot notation exclusion for uppercase first letters variables
'dot-notation': ['error', { allowPattern: '^[A-Z][a-zA-Z]+$' }]
}
};
extends: [
'@nextcloud',
],
}
14 changes: 3 additions & 11 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
module.exports = {
presets: [
[
'@babel/preset-env',
{
useBuiltIns: 'usage',
corejs: 3
}
]
]
}
const babelConfig = require('@nextcloud/babel-config')

module.exports = babelConfig
4,046 changes: 2,941 additions & 1,105 deletions package-lock.json

Large diffs are not rendered by default.

12 changes: 2 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,10 @@
},
"devDependencies": {
"@babel/core": "^7.16.0",
"@babel/preset-env": "^7.16.4",
"@nextcloud/babel-config": "^1.2.0",
"@nextcloud/browserslist-config": "^3.0.0",
"babel-eslint": "^10.1.0",
"@nextcloud/eslint-config": "^8.4.1",
"babel-loader": "^9.1.0",
"eslint": "^7.32.0",
"eslint-config-standard": "^16.0.3",
"eslint-loader": "^4.0.2",
"eslint-plugin-node": "^11.1.0",
"istanbul": "^0.4.5",
"jasmine": "^5.0.0",
"karma": "^6.3.9",
Expand All @@ -62,9 +58,5 @@
"webpack": "^5.65.0",
"webpack-cli": "^5.0.0",
"webpack-merge": "^5.8.0"
},
"dependencies": {
"core-js": "^3.19.3",
"regenerator-runtime": "^0.14.0"
}
}
10 changes: 5 additions & 5 deletions src/debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@

/**
* creates a debug function bound to a context
* @param {String} context
* @returns {Function}
* @param {string} context

Check warning on line 26 in src/debug.js

View workflow job for this annotation

GitHub Actions / node20

Missing JSDoc @param "context" description
* @return {Function}
*/
export function debugFactory(context) {
return (...args) => {
if (debugFactory.enabled) {
// eslint-disable-next-line no-console
console.debug(context, ...args);
console.debug(context, ...args)
}
};
}
}

debugFactory.enabled = false;
debugFactory.enabled = false
6 changes: 3 additions & 3 deletions src/errors/attachError.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ export default class AttachError extends Error {

/**
*
* @param {Object} attach
* @param {object} attach

Check warning on line 33 in src/errors/attachError.js

View workflow job for this annotation

GitHub Actions / node20

Missing JSDoc @param "attach" description
*/
constructor(attach) {
super();
super()

Object.assign(this, attach);
Object.assign(this, attach)
}

}
2 changes: 1 addition & 1 deletion src/errors/networkRequestAbortedError.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
*
*/

import AttachError from './attachError.js';
import AttachError from './attachError.js'

export default class NetworkRequestAbortedError extends AttachError {}
2 changes: 1 addition & 1 deletion src/errors/networkRequestClientError.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
*
*/

import NetworkRequestHttpError from './networkRequestHttpError.js';
import NetworkRequestHttpError from './networkRequestHttpError.js'

export default class NetworkRequestClientError extends NetworkRequestHttpError {}
2 changes: 1 addition & 1 deletion src/errors/networkRequestError.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
*
*/

import AttachError from './attachError.js';
import AttachError from './attachError.js'

export default class NetworkRequestError extends AttachError {}
2 changes: 1 addition & 1 deletion src/errors/networkRequestHttpError.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
*
*/

import AttachError from './attachError.js';
import AttachError from './attachError.js'

export default class NetworkRequestHttpError extends AttachError {}
2 changes: 1 addition & 1 deletion src/errors/networkRequestServerError.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
*
*/

import NetworkRequestHttpError from './networkRequestHttpError.js';
import NetworkRequestHttpError from './networkRequestHttpError.js'

export default class NetworkRequestServerError extends NetworkRequestHttpError {}
Loading

0 comments on commit 486fea8

Please sign in to comment.