Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .eslintignore

This file was deleted.

32 changes: 18 additions & 14 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"no-shadow": 0,
"@typescript-eslint/no-shadow": 2,
"no-shadow-restricted-names": 2,
"no-spaced-func": 2,
"func-call-spacing": [2, "never"],
"no-trailing-spaces": 2,
"no-undef-init": 2,
"no-unused-expressions": 2,
Expand All @@ -62,7 +62,11 @@
"key-spacing": [2, { "align": "value" }],
"max-nested-callbacks": [2, 3],
"new-parens": 2,
"newline-after-var": [2, "always"],
"padding-line-between-statements": [
2,
{ "blankLine": "always", "prev": ["const", "let", "var"], "next": "*" },
{ "blankLine": "any", "prev": ["const", "let", "var"], "next": ["const", "let", "var"] }
],
"no-lonely-if": 2,
"no-multiple-empty-lines": [2, { "max": 2 }],
"no-nested-ternary": 2,
Expand Down Expand Up @@ -98,33 +102,33 @@
"prefer-rest-params": 0,
"prefer-spread": 0,
"@typescript-eslint/no-explicit-any": 0,
"@typescript-eslint/no-extra-parens": 2,
"no-extra-parens": 2,
"@typescript-eslint/no-require-imports": 0,
"@typescript-eslint/no-use-before-define": [2, "nofunc"],
"@typescript-eslint/no-var-requires": [0],
"@typescript-eslint/explicit-function-return-type": "off",
"no-unused-vars": 0,
"@typescript-eslint/no-unused-vars": 2,
"@typescript-eslint/no-unused-expressions": 0,
"@typescript-eslint/no-unused-vars": [2, {
"caughtErrors": "none",
"argsIgnorePattern": "^_",
"varsIgnorePattern": "^_$"
}],
"@typescript-eslint/no-empty-function": 0,
"@typescript-eslint/no-this-alias": 0,
"@typescript-eslint/ban-ts-comment": 0,
"@typescript-eslint/no-unsafe-function-type": 0,
"@typescript-eslint/no-wrapper-object-types": 0,
"no-prototype-builtins": 0,
"@typescript-eslint/ban-types": [
"error",
{
"types": {
"Function": false
}
}
]
"no-constant-binary-expression": 0
},
"overrides": [
{
"files": ["*.ts"],
"rules": {
"@typescript-eslint/explicit-function-return-type": [2, { "allowExpressions": true }],
"@typescript-eslint/no-empty-function": 2,
"prefer-spread": 2,
"@typescript-eslint/ban-ts-ignore": 0
"prefer-spread": 2
}
}
]
Expand Down
14 changes: 7 additions & 7 deletions .github/scripts/security-checker.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ const LABELS = {
const ALERT_TYPES = {
dependabot: 'dependabot',
codeq: 'codeql',
}
};

class SecurityChecker {
constructor(github, context, issueRepo) {
constructor (github, context, issueRepo) {
this.github = github;
this.issueRepo = issueRepo;
this.context = {
Expand Down Expand Up @@ -88,7 +88,7 @@ class SecurityChecker {
}

async closeSpoiledIssues () {
const regExpAlertNumbers = new RegExp(`(?<=\`${this.context.repo}\` - https:.*/dependabot/)\\d+`,'g');
const regExpAlertNumbers = new RegExp(`(?<=\`${this.context.repo}\` - https:.*/dependabot/)\\d+`, 'g');

for (const alert of this.alertDictionary.values()) {

Expand All @@ -101,7 +101,7 @@ class SecurityChecker {
const updates = {};
let changedBody = alert.issue.body;

for (let alertNumber of alertNumbers) {
for (const alertNumber of alertNumbers) {
const isAlertOpened = await this.isDependabotAlertOpened(alertNumber);

if (isAlertOpened)
Expand Down Expand Up @@ -150,9 +150,9 @@ class SecurityChecker {

async createDependabotlIssues (dependabotAlerts) {
for (const alert of dependabotAlerts) {
if (this.needAddAlertToIssue(alert)) {
if (this.needAddAlertToIssue(alert))
await this.addAlertToIssue(alert);
}

else if (this.needCreateIssue(alert)) {
await this.createIssue({
labels: [LABELS.dependabot, LABELS.security, alert.dependency.scope],
Expand All @@ -177,7 +177,7 @@ class SecurityChecker {
return existedIssue
&& existedIssue.cveId === alert.security_advisory.cve_id
&& existedIssue.ghsaId === alert.security_advisory.ghsa_id
&& (!isAlertExisted || (isAlertExisted && !alertNumber));
&& (!isAlertExisted || isAlertExisted && !alertNumber);
}

async addAlertToIssue (alert) {
Expand Down
2 changes: 1 addition & 1 deletion Gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ gulp.task('clean', () => {

// Lint
gulp.task('lint', () => {
const eslint = require('gulp-eslint');
const eslint = require('gulp-eslint-new');

return gulp
.src([
Expand Down
73 changes: 73 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
const fs = require('fs');
const path = require('path');
const json5 = require('json5');
const js = require('@eslint/js');
const { FlatCompat } = require('@eslint/eslintrc');

const hammerheadPlugin = require('eslint-plugin-hammerhead');

function wrapLegacyRule (rule) {
if (typeof rule !== 'function')
return rule;

return {
meta: {},
create: rule,
};
}

hammerheadPlugin.rules = Object.fromEntries(
Object.entries(hammerheadPlugin.rules).map(([name, rule]) => [name, wrapLegacyRule(rule)])
);

const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
});

function readConfig (relativePath) {
return json5.parse(fs.readFileSync(path.join(__dirname, relativePath), 'utf8'));
}

function scopeConfigs (files, configs) {
return configs.map(config => ({
...config,
files,
}));
}

module.exports = [
{
ignores: ['test/server/data/**/*.js'],
},
...compat.config(readConfig('.eslintrc')),
...scopeConfigs(['examples/**/*.js'], compat.config(readConfig('examples/.eslintrc'))),
...scopeConfigs(['src/**/*.{js,ts}'], compat.config(readConfig('src/.eslintrc'))),
...scopeConfigs(['src/cli/**/*.{js,ts}'], compat.config(readConfig('src/cli/.eslintrc'))),
...scopeConfigs(['src/client/**/*.{js,ts}'], compat.config(readConfig('src/client/.eslintrc'))),
...scopeConfigs(['src/client/browser/**/*.{js,ts}'], compat.config(readConfig('src/client/browser/.eslintrc'))),
...scopeConfigs(['test/docker/**/*.js'], compat.config(readConfig('test/docker/.eslintrc'))),
...scopeConfigs(['test/client/**/*.js'], compat.config(readConfig('test/client/.eslintrc'))),
...scopeConfigs(['test/client/fixtures/**/*.js'], compat.config(readConfig('test/client/fixtures/.eslintrc'))),
...scopeConfigs(['test/functional/**/*.js'], compat.config(readConfig('test/functional/.eslintrc'))),
...scopeConfigs(['test/functional/fixtures/**/*.js'], compat.config(readConfig('test/functional/fixtures/.eslintrc'))),
...scopeConfigs(['test/functional/legacy-fixtures/**/*.js'], compat.config(readConfig('test/functional/legacy-fixtures/.eslintrc'))),
...scopeConfigs(['test/server/**/*.js'], compat.config(readConfig('test/server/.eslintrc'))),
{
files: ['src/client/rollup.config.js'],
languageOptions: {
globals: {
__dirname: 'readonly',
__filename: 'readonly',
Buffer: 'readonly',
clearInterval: 'readonly',
clearTimeout: 'readonly',
global: 'readonly',
process: 'readonly',
setInterval: 'readonly',
setTimeout: 'readonly',
},
},
},
];
Loading
Loading