1
0
mirror of https://github.com/verdaccio/verdaccio.git synced 2025-02-21 07:29:37 +01:00

chore: eslint config module (#2263)

* build: eslint config as package

* chore: fix formatting
This commit is contained in:
Juan Picado 2021-05-16 17:11:08 +02:00 committed by GitHub
parent d2c65da9c7
commit f3f00052d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
38 changed files with 924 additions and 674 deletions

102
.eslintrc

@ -1,102 +0,0 @@
{
"extends": [
"eslint:recommended",
"google",
"plugin:react/recommended",
"plugin:jest/recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:import/typescript",
"plugin:jsx-a11y/recommended",
"prettier"
],
"plugins": ["import", "jest", "jsx-a11y", "react-hooks"],
"env": {
"es6": true,
"node": true,
"jest": true
},
"globals": {
"__APP_VERSION__": true
},
"parserOptions": {
"allowImportExportEverywhere": true,
"sourceType": "module",
"ecmaVersion": 11,
"ecmaFeatures": {
"impliedStrict": true,
"jsx": true
}
},
"settings": {
"import/resolver": {
"node": {
"extensions": [".js", ".jsx", ".ts", ".tsx"]
}
}
},
"parser": "@typescript-eslint/parser",
"rules": {
"curly": ["error", "all"],
"react/prop-types": 0,
"jest/no-export": 0,
"jest/no-test-callback": 0,
"jest/expect-expect": 0,
"jest/no-try-expect": 0,
"jest/no-done-callback": "off",
"jest/no-conditional-expect": "off",
"keyword-spacing": "off",
"no-tabs": "off",
"no-useless-escape": "off",
"padded-blocks": "off",
"require-jsdoc": "off",
"valid-jsdoc": "off",
"import/order": ["error"],
"eol-last": "error",
"no-irregular-whitespace": "error",
"no-mixed-spaces-and-tabs": ["error", "smart-tabs"],
"no-trailing-spaces": "error",
"camelcase": "off",
"guard-for-in": "error",
"new-cap": "error",
"max-len": ["error", 100],
"no-console": ["error", { "allow": ["warn"] }],
"no-constant-condition": "error",
"no-debugger": "error",
"no-empty": "error",
"no-fallthrough": "error",
"no-invalid-this": "error",
"no-new-require": "error",
"no-undef": "error",
"no-unreachable": "error",
"no-var": "error",
"one-var": "error",
"prefer-rest-params": "error",
"prefer-spread": "error",
"handle-callback-err": 0,
"prefer-const": 0,
"@typescript-eslint/camelcase": 0,
"@typescript-eslint/ban-ts-ignore": 0,
"@typescript-eslint/no-var-requires": 0,
"@typescript-eslint/no-inferrable-types": 0,
"@typescript-eslint/no-empty-function": 0,
"@typescript-eslint/no-this-alias": 0,
"@typescript-eslint/no-use-before-define": 0,
"@typescript-eslint/array-type": ["error"],
"@typescript-eslint/no-explicit-any": 0,
"@typescript-eslint/indent": 0,
"@typescript-eslint/ban-ts-comment": 0,
"@typescript-eslint/ban-types": 0,
"@typescript-eslint/explicit-module-boundary-types": 0,
// rules to fix
"no-unused-vars": ["warn", { "vars": "all", "args": "none" }],
"jest/no-identical-title": ["warn"],
"prefer-promise-reject-errors": ["warn"],
"jest/no-disabled-tests": ["warn"],
"jest/no-commented-out-tests": ["warn"],
"@typescript-eslint/prefer-optional-chain": ["warn"],
"@typescript-eslint/explicit-member-accessibility": ["warn"],
"@typescript-eslint/no-unused-vars": ["warn"]
}
}

3
.eslintrc.js Normal file

@ -0,0 +1,3 @@
module.exports = {
extends: ['@verdaccio/eslint-config'],
};

@ -44,7 +44,7 @@ class LocalMemory {
} else {
this.logger.info(
{limit: this.limit},
'Storage memory has reached limit of @{limit} packages'
'Storage memory has reached limit of @{limit} packages',
);
cb(new Error('Storage memory has reached limit of limit packages'));
}

@ -39,8 +39,8 @@
"@babel/register": "7.13.14",
"@babel/runtime": "7.13.10",
"@changesets/changelog-github": "^0.2.8",
"@changesets/cli": "^2.15.0",
"@changesets/get-dependents-graph": "^1.2.0",
"@changesets/cli": "^2.16.0",
"@changesets/get-dependents-graph": "^1.2.1",
"@commitlint/cli": "8.3.5",
"@commitlint/config-conventional": "8.2.0",
"@octokit/rest": "17.0.0",
@ -71,6 +71,7 @@
"@typescript-eslint/parser": "4.13.0",
"@verdaccio/types": "workspace:*",
"@verdaccio/ui-theme": "workspace:*",
"@verdaccio/eslint-config": "workspace:*",
"babel-core": "7.0.0-bridge.0",
"babel-eslint": "10.1.0",
"babel-jest": "26.6.3",
@ -78,20 +79,21 @@
"babel-plugin-emotion": "11.0.0",
"codecov": "3.8.1",
"concurrently": "^5.3.0",
"core-js": "^3.10.1",
"core-js": "^3.12.1",
"cross-env": "7.0.3",
"detect-secrets": "1.0.6",
"eslint": "7.19.0",
"eslint": "7.26.0",
"eslint-config-google": "0.14.0",
"eslint-config-prettier": "7.2.0",
"eslint-config-prettier": "8.3.0",
"eslint-plugin-babel": "5.3.1",
"eslint-plugin-import": "2.22.1",
"eslint-plugin-jest": "24.1.3",
"eslint-plugin-import": "2.23.2",
"eslint-plugin-jest": "24.3.6",
"eslint-plugin-jsx-a11y": "6.4.1",
"eslint-plugin-react": "7.22.0",
"eslint-plugin-react": "7.23.2",
"eslint-plugin-react-hooks": "4.2.0",
"eslint-plugin-simple-import-sort": "7.0.0",
"eslint-plugin-verdaccio": "9.6.1",
"eslint-plugin-verdaccio": "10.0.0",
"eslint-plugin-prettier": "3.4.0",
"fs-extra": "9.1.0",
"get-stdin": "7.0.0",
"husky": "2.7.0",
@ -107,14 +109,14 @@
"nock": "12.0.3",
"nodemon": "^2.0.7",
"npm-run-all": "4.1.5",
"prettier": "2.2.1",
"prettier": "2.3.0",
"rimraf": "3.0.2",
"selfsigned": "1.10.8",
"supertest": "4.0.2",
"ts-node": "^9.1.1",
"typescript": "^4.2.4",
"update-ts-references": "2.3.0",
"verdaccio": "^5.0.1",
"verdaccio": "^5.0.4",
"verdaccio-audit": "workspace:*",
"verdaccio-auth-memory": "workspace:*",
"verdaccio-htpasswd": "workspace:*",

@ -41,7 +41,7 @@ export default function (route, auth, storage): void {
route.get('/-/v1/search', (req, res) => {
// TODO: implement proper result scoring weighted by quality, popularity and
// maintenance query parameters
let [text, size, from /* , quality, popularity, maintenance */] = [
let [text, size, from] = [
'text',
'size',
'from' /* , 'quality', 'popularity', 'maintenance' */,

@ -5,7 +5,8 @@ import { $ResponseExtend, $RequestExtend } from '../../types/custom';
import { initializeServer, publishTaggedVersion, publishVersion } from './_helper';
const mockApiJWTmiddleware = jest.fn(
() => (req: $RequestExtend, res: $ResponseExtend, _next): void => {
() =>
(req: $RequestExtend, res: $ResponseExtend, _next): void => {
req.remote_user = { name: 'foo', groups: [], real_groups: [] };
_next();
}

@ -11,7 +11,8 @@ import { $ResponseExtend, $RequestExtend } from '../../types/custom';
import { initializeServer, publishVersion } from './_helper';
const mockApiJWTmiddleware = jest.fn(
() => (req: $RequestExtend, res: $ResponseExtend, _next): void => {
() =>
(req: $RequestExtend, res: $ResponseExtend, _next): void => {
req.remote_user = { name: 'foo', groups: [], real_groups: [] };
_next();
}

@ -16,7 +16,8 @@ import { $RequestExtend, $ResponseExtend } from '../../types/custom';
import { initializeServer } from './_helper';
const mockApiJWTmiddleware = jest.fn(
() => (req: $RequestExtend, res: $ResponseExtend, _next): void => {
() =>
(req: $RequestExtend, res: $ResponseExtend, _next): void => {
req.remote_user = { name: 'test', groups: [], real_groups: [] };
_next();
}
@ -53,7 +54,8 @@ describe('user', () => {
test('should test add a new user', async (done) => {
mockApiJWTmiddleware.mockImplementationOnce(
() => (req: $RequestExtend, res: $ResponseExtend, _next): void => {
() =>
(req: $RequestExtend, res: $ResponseExtend, _next): void => {
req.remote_user = { name: undefined };
_next();
}
@ -85,7 +87,8 @@ describe('user', () => {
test('should test fails on add a existing user with login', async (done) => {
mockApiJWTmiddleware.mockImplementationOnce(
() => (req: $RequestExtend, res: $ResponseExtend, _next): void => {
() =>
(req: $RequestExtend, res: $ResponseExtend, _next): void => {
req.remote_user = { name: undefined };
_next();
}
@ -124,7 +127,8 @@ describe('user', () => {
test('should test fails add a new user with missing name', async (done) => {
mockApiJWTmiddleware.mockImplementationOnce(
() => (req: $RequestExtend, res: $ResponseExtend, _next): void => {
() =>
(req: $RequestExtend, res: $ResponseExtend, _next): void => {
req.remote_user = { name: undefined };
_next();
}
@ -153,7 +157,8 @@ describe('user', () => {
test('should test fails add a new user with missing password', async (done) => {
mockApiJWTmiddleware.mockImplementationOnce(
() => (req: $RequestExtend, res: $ResponseExtend, _next): void => {
() =>
(req: $RequestExtend, res: $ResponseExtend, _next): void => {
req.remote_user = { name: undefined };
_next();
}
@ -181,7 +186,8 @@ describe('user', () => {
test('should test fails add a new user with wrong password', async (done) => {
mockApiJWTmiddleware.mockImplementationOnce(
() => (req: $RequestExtend, res: $ResponseExtend, _next): void => {
() =>
(req: $RequestExtend, res: $ResponseExtend, _next): void => {
req.remote_user = { name: 'test' };
_next();
}
@ -210,7 +216,8 @@ describe('user', () => {
test('should be able to logout an user', async (done) => {
mockApiJWTmiddleware.mockImplementationOnce(
() => (req: $RequestExtend, res: $ResponseExtend, _next): void => {
() =>
(req: $RequestExtend, res: $ResponseExtend, _next): void => {
req.remote_user = { name: 'test' };
_next();
}

@ -6,7 +6,8 @@ import { $RequestExtend, $ResponseExtend } from '../../types/custom';
import { initializeServer } from './_helper';
const mockApiJWTmiddleware = jest.fn(
() => (req: $RequestExtend, res: $ResponseExtend, _next): void => {
() =>
(req: $RequestExtend, res: $ResponseExtend, _next): void => {
req.remote_user = { name: 'foo', groups: [], real_groups: [] };
_next();
}

@ -31,7 +31,7 @@ describe('HTPasswd', () => {
let wrapper;
beforeEach(() => {
wrapper = new HTPasswd(getDefaultConfig(), (stuff as unknown) as VerdaccioConfigApp);
wrapper = new HTPasswd(getDefaultConfig(), stuff as unknown as VerdaccioConfigApp);
jest.resetModules();
crypto.randomBytes = jest.fn(() => {

@ -59,8 +59,7 @@ export function loadPlugin<T extends IPlugin<T>>(
sanityCheck: any,
prefix: string = 'verdaccio'
): any[] {
return Object.keys(pluginConfigs).map(
(pluginId: string): IPlugin<T> => {
return Object.keys(pluginConfigs).map((pluginId: string): IPlugin<T> => {
let plugin;
const localPlugin = Path.resolve(__dirname + '/../plugins', pluginId);
@ -139,6 +138,5 @@ export function loadPlugin<T extends IPlugin<T>>(
debug('Plugin successfully loaded: %o-%o', pluginId, prefix);
return plugin;
}
);
});
}

@ -51,7 +51,7 @@ class ActiveDirectoryPlugin implements IPluginAuth<ActiveDirectoryConfig> {
connection.getGroupMembershipForUser(username, (err, groups: object[]): void => {
if (err) {
this.logger.warn(`AD - Active Directory group check failed with error: ${err}`);
return cb(getInternalError((err as unknown) as string));
return cb(getInternalError(err as unknown as string));
}
const requestedGroups = Array.isArray(groupName) ? groupName : [groupName];

@ -83,7 +83,7 @@ describe('Active Directory Plugin', () => {
const errorMessage = 'Unknown error retrieving groups';
ActiveDirectory.prototype.authenticate = jest.fn((_1, _2, cb) => cb(null, true));
ActiveDirectory.prototype.getGroupMembershipForUser = jest.fn((_, cb) =>
cb((errorMessage as unknown) as object, null)
cb(errorMessage as unknown as object, null)
) as jest.Mock;
adPluginSingleGroup.authenticate('', '', (error, authUser) => {

@ -29,14 +29,8 @@ export default class S3PackageManager implements ILocalPackageManager {
this.config = config;
this.packageName = packageName;
this.logger = logger;
const {
endpoint,
region,
s3ForcePathStyle,
accessKeyId,
secretAccessKey,
sessionToken,
} = config;
const { endpoint, region, s3ForcePathStyle, accessKeyId, secretAccessKey, sessionToken } =
config;
this.s3 = new S3({
endpoint,

@ -79,7 +79,7 @@ describe.skip('S3 package manager', () => {
describe('savePackage() group', () => {
test('savePackage()', (done) => {
const data = ('{data:5}' as unknown) as Package;
const data = '{data:5}' as unknown as Package;
const packageManager = new S3PackageManager(config, 'first-package', logger);
packageManager.savePackage('pkg.1.0.0.tar.gz', data, (err) => {

@ -118,14 +118,12 @@ class GoogleCloudDatabase implements IPluginStorage<VerdaccioConfigGoogleStorage
// "{\"secret\":\"181bc38698078f880564be1e4d7ec107ac8a3b344a924c6d86cea4a84a885ae0\"}"
return entities.secret;
})
.catch(
(err: Error): Promise<string> => {
.catch((err: Error): Promise<string> => {
const error: VerdaccioError = getInternalError(err.message);
this.logger.warn({ error }, 'gcloud: [datastore getSecret] init error @{error}');
return Promise.reject(getServiceUnavailable('[getSecret] permissions error'));
}
);
});
}
public setSecret(secret: string): Promise<CommitResponse> {
@ -194,8 +192,7 @@ class GoogleCloudDatabase implements IPluginStorage<VerdaccioConfigGoogleStorage
// };
this.helper
.getEntities(this.kind)
.then(
async (entities: any): Promise<void> => {
.then(async (entities: any): Promise<void> => {
for (const item of entities) {
if (item.name === name) {
await this._deleteItem(name, item);
@ -203,8 +200,7 @@ class GoogleCloudDatabase implements IPluginStorage<VerdaccioConfigGoogleStorage
}
}
cb(null);
}
)
})
.catch((err: Error): void => {
cb(getInternalError(err.message));
});

@ -90,16 +90,14 @@ class GoogleCloudStorageHandler implements IPackageStorageManager {
onEnd(getInternalError(err.message));
}
)
.catch(
(err: Error): Callback => {
.catch((err: Error): Callback => {
this.logger.error(
{ name, error: err },
'gcloud: trying to update @{name} and was not found on storage err: @{error}'
);
// @ts-ignore
return onEnd(getNotFound());
}
);
});
}
public deletePackage(fileName: string, cb: CallbackAction): void {
@ -197,8 +195,7 @@ class GoogleCloudStorageHandler implements IPackageStorageManager {
/* eslint-disable no-async-promise-executor */
private _savePackage(name: string, metadata: Package): Promise<null | VerdaccioError> {
return new Promise(
async (resolve, reject): Promise<void> => {
return new Promise(async (resolve, reject): Promise<void> => {
const file = this.helper.buildFilePath(name, pkgFileName);
try {
await file.save(this._convertToString(metadata), {
@ -217,8 +214,7 @@ class GoogleCloudStorageHandler implements IPackageStorageManager {
} catch (err) {
reject(getInternalError(err.message));
}
}
);
});
}
/* eslint-enable no-async-promise-executor */
@ -244,8 +240,7 @@ class GoogleCloudStorageHandler implements IPackageStorageManager {
/* eslint-disable no-async-promise-executor */
private _fileExist(name: string, fileName: string): Promise<boolean> {
return new Promise(
async (resolve, reject): Promise<void> => {
return new Promise(async (resolve, reject): Promise<void> => {
const file: File = this.helper.buildFilePath(name, fileName);
try {
// @ts-ignore
@ -265,13 +260,11 @@ class GoogleCloudStorageHandler implements IPackageStorageManager {
reject(getInternalError(err.message));
}
}
);
});
}
private async _readPackage(name: string): Promise<Package> {
return new Promise(
async (resolve, reject): Promise<void> => {
return new Promise(async (resolve, reject): Promise<void> => {
const file = this.helper.buildFilePath(name, pkgFileName);
try {
@ -284,8 +277,7 @@ class GoogleCloudStorageHandler implements IPackageStorageManager {
this.logger.debug({ name: this.name }, 'gcloud: @{name} package not found on storage');
reject(getNotFound());
}
}
);
});
}
/* eslint-disable no-async-promise-executor */

@ -21,8 +21,13 @@ export interface FilterOptionsState<Option> {
}
function createFilterOptions(config?: CreateFilterOptionsConfig) {
const { ignoreAccents = true, ignoreCase = true, trim = false, limit, matchFrom = 'any' } =
config || {};
const {
ignoreAccents = true,
ignoreCase = true,
trim = false,
limit,
matchFrom = 'any',
} = config || {};
return <Option extends {}>(
options: Option[],

@ -6,7 +6,8 @@ import { Theme } from './theme';
const resetStyles = makeStyles(({ theme }: { theme?: Theme }) => ({
'@global': {
// eslint-disable-next-line max-len
'html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video': {
'html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video':
{
fontFamily: '"Roboto", Helvetica Neue, Arial, sans-serif',
},
strong: {

@ -22,18 +22,8 @@ const cache = new CellMeasurerCache({
/* eslint-disable verdaccio/jsx-no-style */
const PackageList: React.FC<Props> = ({ packages }) => {
const renderRow = ({ index, key, parent, style }: ListRowProps) => {
const {
name,
version,
description,
time,
keywords,
dist,
homepage,
bugs,
author,
license,
} = packages[index];
const { name, version, description, time, keywords, dist, homepage, bugs, author, license } =
packages[index];
// TODO: move format license to API side.
const formattedLicense = formatLicense(license);

@ -1,8 +1,8 @@
import { SyntheticEvent } from 'react';
export const copyToClipBoardUtility = (str: string): ((e: SyntheticEvent<HTMLElement>) => void) => (
event: SyntheticEvent<HTMLElement>
): void => {
export const copyToClipBoardUtility =
(str: string): ((e: SyntheticEvent<HTMLElement>) => void) =>
(event: SyntheticEvent<HTMLElement>): void => {
event.preventDefault();
const node = document.createElement('div');

@ -41,8 +41,7 @@ const json = {
_attachments: {
'forbidden-place-1.0.6.tgz': {
content_type: 'application/octet-stream',
data:
'H4sIAAAAAAAAE+2W32vbMBDH85y/QnjQp9qxLEeBMsbGlocNBmN7bFdQ5WuqxJaEpGQdo//79KPeQsnIw5KUDX/9IOvurLuz/DHSjK/YAiY6jcXSKjk6sMqypHWNdtmD6hlBI0wqQmo8nVbVqMR4OsNoVB66kF1aW8eML+Vv10m9oF/jP6IfY4QyyTrILlD2eqkcm+gVzpdrJrPz4NuAsULJ4MZFWdBkbcByI7R79CRjx0ScCdnAvf+SkjUFWu8IubzBgXUhDPidQlfZ3BhlLpBUKDiQ1cDFrYDmKkNnZwjuhUM4808+xNVW8P2bMk1Y7vJrtLC1u1MmLPjBF40+Cc4ahV6GDmI/DWygVRpMwVX3KtXUCg7Sxp7ff3nbt6TBFy65gK1iffsN41yoEHtdFbOiisWMH8bPvXUH0SP3k+KG3UBr+DFy7OGfEJr4x5iWVeS/pLQe+D+FIv/agIWI6GX66kFuIhT+1gDjrp/4d7WAvAwEJPh0u14IufWkM0zaW2W6nLfM2lybgJ4LTJ0/jWiAK8OcMjt8MW3OlfQppcuhhQ6k+2OgkK2Q8DssFPi/IHpU9fz3/+xj5NjDf8QFE39VmE4JDfzPCBn4P4X6/f88f/Pu47zomiPk2Lv/dOv8h+P/34/D/p9CL+Kp67mrGDRo0KBBp9ZPsETQegASAAA=',
data: 'H4sIAAAAAAAAE+2W32vbMBDH85y/QnjQp9qxLEeBMsbGlocNBmN7bFdQ5WuqxJaEpGQdo//79KPeQsnIw5KUDX/9IOvurLuz/DHSjK/YAiY6jcXSKjk6sMqypHWNdtmD6hlBI0wqQmo8nVbVqMR4OsNoVB66kF1aW8eML+Vv10m9oF/jP6IfY4QyyTrILlD2eqkcm+gVzpdrJrPz4NuAsULJ4MZFWdBkbcByI7R79CRjx0ScCdnAvf+SkjUFWu8IubzBgXUhDPidQlfZ3BhlLpBUKDiQ1cDFrYDmKkNnZwjuhUM4808+xNVW8P2bMk1Y7vJrtLC1u1MmLPjBF40+Cc4ahV6GDmI/DWygVRpMwVX3KtXUCg7Sxp7ff3nbt6TBFy65gK1iffsN41yoEHtdFbOiisWMH8bPvXUH0SP3k+KG3UBr+DFy7OGfEJr4x5iWVeS/pLQe+D+FIv/agIWI6GX66kFuIhT+1gDjrp/4d7WAvAwEJPh0u14IufWkM0zaW2W6nLfM2lybgJ4LTJ0/jWiAK8OcMjt8MW3OlfQppcuhhQ6k+2OgkK2Q8DssFPi/IHpU9fz3/+xj5NjDf8QFE39VmE4JDfzPCBn4P4X6/f88f/Pu47zomiPk2Lv/dOv8h+P/34/D/p9CL+Kp67mrGDRo0KBBp9ZPsETQegASAAA=',
length: 512,
},
},

@ -41,8 +41,7 @@ const json = {
_attachments: {
'@scope/pk1-test-1.0.6.tgz': {
content_type: 'application/octet-stream',
data:
'H4sIAAAAAAAAE+2W32vbMBDH85y/QnjQp9qxLEeBMsbGlocNBmN7bFdQ5WuqxJaEpGQdo//79KPeQsnIw5KUDX/9IOvurLuz/DHSjK/YAiY6jcXSKjk6sMqypHWNdtmD6hlBI0wqQmo8nVbVqMR4OsNoVB66kF1aW8eML+Vv10m9oF/jP6IfY4QyyTrILlD2eqkcm+gVzpdrJrPz4NuAsULJ4MZFWdBkbcByI7R79CRjx0ScCdnAvf+SkjUFWu8IubzBgXUhDPid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v/dOv8h+P/34/D/p9CL+Kp67mrGDRo0KBBp9ZPsETQegASAAA=',
length: 512,
},
},

@ -0,0 +1,20 @@
{
"name": "@verdaccio/eslint-config",
"version": "1.0.0",
"private": "true",
"description": "verdaccio eslint config",
"main": "src/index.js",
"scripts": {
"lint": "eslint . --ext .js"
},
"author": {
"name": "Juan Picado",
"email": "juanpicado19@gmail.com"
},
"repository": {
"type": "https",
"url": "https://github.com/verdaccio/verdaccio"
},
"homepage": "https://verdaccio.org",
"license": "MIT"
}

@ -0,0 +1,27 @@
module.exports = {
extends: ['./rules/base.js', './rules/prettier.js', './rules/react.js', './rules/jest.js'],
env: {
es6: true,
node: true,
},
globals: {
__APP_VERSION__: true,
},
parserOptions: {
allowImportExportEverywhere: true,
sourceType: 'module',
ecmaVersion: 11,
ecmaFeatures: {
impliedStrict: true,
jsx: true,
},
},
settings: {
'import/resolver': {
node: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
},
},
parser: '@typescript-eslint/parser',
};

@ -0,0 +1,64 @@
module.exports = {
extends: [
'eslint:recommended',
'google',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:import/typescript',
],
plugins: ['import'],
rules: {
curly: ['error', 'all'],
'keyword-spacing': 'off',
'no-tabs': 'off',
'no-useless-escape': 'off',
'padded-blocks': 'off',
'require-jsdoc': 'off',
'valid-jsdoc': 'off',
'import/order': ['error'],
'eol-last': 'error',
'no-irregular-whitespace': 'error',
'no-mixed-spaces-and-tabs': ['error', 'smart-tabs'],
'no-trailing-spaces': 'error',
camelcase: 'off',
'guard-for-in': 'error',
'new-cap': 'error',
'max-len': ['error', 100],
'no-console': ['error', { allow: ['warn'] }],
'no-constant-condition': 'error',
'no-debugger': 'error',
'no-empty': 'error',
'no-fallthrough': 'error',
'no-invalid-this': 'error',
'no-new-require': 'error',
'no-undef': 'error',
'no-unreachable': 'error',
'no-var': 'error',
'one-var': 'error',
'prefer-rest-params': 'error',
'prefer-spread': 'error',
'handle-callback-err': 0,
'prefer-const': 0,
// typescript
'@typescript-eslint/camelcase': 0,
'@typescript-eslint/ban-ts-ignore': 0,
'@typescript-eslint/no-var-requires': 0,
'@typescript-eslint/no-inferrable-types': 0,
'@typescript-eslint/no-empty-function': 0,
'@typescript-eslint/no-this-alias': 0,
'@typescript-eslint/no-use-before-define': 0,
'@typescript-eslint/array-type': ['error'],
'@typescript-eslint/no-explicit-any': 0,
'@typescript-eslint/indent': 0,
'@typescript-eslint/ban-ts-comment': 0,
'@typescript-eslint/ban-types': 0,
'@typescript-eslint/explicit-module-boundary-types': 0,
// rules to fix
'no-unused-vars': ['warn', { vars: 'all', args: 'none' }],
'prefer-promise-reject-errors': ['warn'],
'@typescript-eslint/prefer-optional-chain': ['warn'],
'@typescript-eslint/explicit-member-accessibility': ['warn'],
'@typescript-eslint/no-unused-vars': ['warn'],
},
};

@ -0,0 +1,19 @@
module.exports = {
extends: ['plugin:jest/recommended'],
plugins: ['jest'],
env: {
jest: true,
},
rules: {
'jest/no-export': 0,
'jest/no-test-callback': 0,
'jest/expect-expect': 0,
'jest/no-try-expect': 0,
'jest/no-done-callback': 'off',
'jest/no-conditional-expect': 'off',
// rules to fix
'jest/no-identical-title': ['warn'],
'jest/no-disabled-tests': ['warn'],
'jest/no-commented-out-tests': ['warn'],
},
};

@ -0,0 +1,4 @@
module.exports = {
extends: ['plugin:prettier/recommended'],
plugins: ['prettier'],
};

@ -0,0 +1,15 @@
module.exports = {
extends: [
'plugin:react/recommended',
'plugin:react-hooks/recommended',
'plugin:jsx-a11y/recommended',
'plugin:jsx-a11y/recommended',
],
plugins: ['import'],
env: {
browser: true,
},
rules: {
'react/prop-types': 0,
},
};

@ -41,8 +41,7 @@ const json = {
_attachments: {
'forbidden-place-1.0.6.tgz': {
content_type: 'application/octet-stream',
data:
'H4sIAAAAAAAAE+2W32vbMBDH85y/QnjQp9qxLEeBMsbGlocNBmN7bFdQ5WuqxJaEpGQdo//79KPeQsnIw5KUDX/9IO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Iv/agIWI6GX66kFuIhT+1gDjrp/4d7WAvAwEJPh0u14IufWkM0zaW2W6nLfM2lybgJ4LTJ0/jWiAK8OcMjt8MW3OlfQppcuhhQ6k+2OgkK2Q8DssFPi/IHpU9fz3/+xj5NjDf8QFE39VmE4JDfzPCBn4P4X6/f88f/Pu47zomiPk2Lv/dOv8h+P/34/D/p9CL+Kp67mrGDRo0KBBp9ZPsETQegASAAA=',
length: 512,
},
},

@ -15,10 +15,7 @@ function addUserAuthApi(route: Router, auth: IAuth, config: Config): void {
route.post('/login', function (req: Request, res: Response, next: $NextFunctionVer): void {
const { username, password } = req.body;
debug('authenticate %o', username);
auth.authenticate(
username,
password,
async (err, user: RemoteUser): Promise<void> => {
auth.authenticate(username, password, async (err, user: RemoteUser): Promise<void> => {
if (err) {
const errorCode = err.message ? HTTP_STATUS.UNAUTHORIZED : HTTP_STATUS.INTERNAL_ERROR;
debug('error authenticate %o', errorCode);
@ -32,8 +29,7 @@ function addUserAuthApi(route: Router, auth: IAuth, config: Config): void {
username: req.remote_user.name,
});
}
}
);
});
});
if (config?.flags?.changePassword === true) {

@ -45,8 +45,7 @@ export function addGravatarSupport(pkgInfo: Package, online = true): AuthorAvata
// for contributors
if (_.isEmpty(contributors) === false) {
pkgInfoCopy.latest.contributors = contributors.map(
(contributor): AuthorAvatar => {
pkgInfoCopy.latest.contributors = contributors.map((contributor): AuthorAvatar => {
if (isObject(contributor)) {
contributor.avatar = generateGravatarUrl(contributor.email, online);
} else if (_.isString(contributor)) {
@ -58,8 +57,7 @@ export function addGravatarSupport(pkgInfo: Package, online = true): AuthorAvata
}
return contributor;
}
);
});
}
// for maintainers

760
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

@ -1,6 +1,7 @@
packages:
- packages/*
- packages/core/*
- packages/tools/*
- packages/plugins/*
- website
- test/e2e-*

@ -41,8 +41,7 @@ const json = {
_attachments: {
'protected-pkg-5.0.5.tgz': {
content_type: 'application/octet-stream',
data:
'H4sIAAAAAAAA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TBFy65gK1iffsN41yoEHtdFbOiisWMH8bPvXUH0SP3k+KG3UBr+DFy7OGfEJr4x5iWVeS/pLQe+D+FIv/agIWI6GX66kFuIhT+1gDjrp/4d7WAvAwEJPh0u14IufWkM0zaW2W6nLfM2lybgJ4LTJ0/jWiAK8OcMjt8MW3OlfQppcuhhQ6k+2OgkK2Q8DssFPi/IHpU9fz3/+xj5NjDf8QFE39VmE4JDfzPCBn4P4X6/f88f/Pu47zomiPk2Lv/dOv8h+P/34/D/p9CL+Kp67mrGDRo0KBBp9ZPsETQegASAAA=',
length: 512,
},
},

@ -41,8 +41,7 @@ const json = {
_attachments: {
'@scope/pk1-test-1.0.6.tgz': {
content_type: 'application/octet-stream',
data:
'H4sIAAAAAAAAE+2W32vbMBDH85y/QnjQp9qxLEeBMsbGlocNBmN7bFdQ5WuqxJaEpGQdo//79KPeQsnIw5KUDX/9IOvurLuz/DHSjK/YAiY6jcXSKjk6sMqypHWNdtmD6hlBI0wqQmo8nVbVqMR4OsNoVB66kF1aW8eML+Vv10m9oF/jP6IfY4QyyTrILlD2eqkcm+gVzpdrJrPz4NuAsULJ4MZFWdBkbcByI7R79CRjx0ScCdnAvf+SkjUFWu8IubzBgXUhDPidQlfZ3BhlLpBUKDiQ1cDFrYDmKkNnZwjuhUM4808+xNVW8P2bMk1Y7vJrtLC1u1MmLPjBF40+Cc4ahV6GDmI/DWygVRpMwVX3KtXUCg7Sxp7ff3nbt6TBFy65gK1iffsN41yoEHtdFbOiisWMH8bPvXUH0SP3k+KG3UBr+DFy7OGfEJr4x5iWVeS/pLQe+D+FIv/agIWI6GX66kFuIhT+1gDjrp/4d7WAvAwEJPh0u14IufWkM0zaW2W6nLfM2lybgJ4LTJ0/jWiAK8OcMjt8MW3OlfQppcuhhQ6k+2OgkK2Q8DssFPi/IHpU9fz3/+xj5NjDf8QFE39VmE4JDfzPCBn4P4X6/f88f/Pu47zomiPk2Lv/dOv8h+P/34/D/p9CL+Kp67mrGDRo0KBBp9ZPsET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