Configure ESLint and update configuration for Prettier (#949)

* Update ESLint and Prettier configurations

* Rebuild action

* Update package.json
This commit is contained in:
Ivan 2023-03-09 14:57:55 +02:00 committed by GitHub
parent 3d90444e57
commit 47a58a6ddf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 3761 additions and 5493 deletions

View File

@ -1,3 +1,6 @@
dist/
lib/
node_modules/
# Ignore list
/*
# Do not ignore these folders:
!__tests__/
!src/

49
.eslintrc.js Normal file
View File

@ -0,0 +1,49 @@
module.exports = {
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:eslint-plugin-jest/recommended',
'eslint-config-prettier'
],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint', 'eslint-plugin-jest'],
rules: {
'@typescript-eslint/no-require-imports': 'error',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/ban-ts-comment': [
'error',
{
'ts-ignore': 'allow-with-description'
}
],
'no-console': 'error',
'yoda': 'error',
'prefer-const': [
'error',
{
destructuring: 'all'
}
],
'no-control-regex': 'off',
'no-constant-condition': ['error', {checkLoops: false}]
},
overrides: [
{
files: ['**/*{test,spec}.ts'],
rules: {
'@typescript-eslint/no-unused-vars': 'off',
'jest/no-standalone-expect': 'off',
'jest/no-conditional-expect': 'off',
'no-console': 'off',
}
}
],
env: {
node: true,
es6: true,
'jest/globals': true
}
};

View File

@ -1,65 +0,0 @@
{
"plugins": ["jest", "@typescript-eslint"],
"extends": ["plugin:github/recommended"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 9,
"sourceType": "module",
"project": "./tsconfig.json"
},
"rules": {
"eslint-comments/no-use": "off",
"import/no-namespace": "off",
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/explicit-member-accessibility": [
"error",
{
"accessibility": "no-public"
}
],
"@typescript-eslint/no-require-imports": "error",
"@typescript-eslint/array-type": "error",
"@typescript-eslint/await-thenable": "error",
"@typescript-eslint/ban-ts-comment": "error",
"camelcase": "off",
"@typescript-eslint/consistent-type-assertions": "error",
"@typescript-eslint/func-call-spacing": ["error", "never"],
"@typescript-eslint/no-array-constructor": "error",
"@typescript-eslint/no-empty-interface": "error",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-extraneous-class": "off",
"@typescript-eslint/no-for-in-array": "error",
"@typescript-eslint/no-inferrable-types": "error",
"@typescript-eslint/no-misused-new": "error",
"@typescript-eslint/no-namespace": "error",
"@typescript-eslint/no-non-null-assertion": "warn",
"@typescript-eslint/no-unnecessary-qualifier": "error",
"@typescript-eslint/no-unnecessary-type-assertion": "error",
"@typescript-eslint/no-useless-constructor": "error",
"@typescript-eslint/no-var-requires": "error",
"@typescript-eslint/prefer-for-of": "warn",
"@typescript-eslint/prefer-function-type": "warn",
"@typescript-eslint/prefer-includes": "error",
"@typescript-eslint/prefer-string-starts-ends-with": "error",
"@typescript-eslint/promise-function-async": "error",
"@typescript-eslint/require-array-sort-compare": "error",
"@typescript-eslint/restrict-plus-operands": "error",
"semi": "off",
"@typescript-eslint/type-annotation-spacing": "error",
"@typescript-eslint/unbound-method": "off",
"no-shadow": "off",
"@typescript-eslint/no-shadow": "error",
"prettier/prettier": [
"error",
{
"endOfLine": "auto"
}
]
},
"env": {
"node": true,
"es6": true,
"jest/globals": true
}
}

1
.gitattributes vendored
View File

@ -1 +1,2 @@
* text=auto eol=lf
.licenses/** -diff linguist-generated=true

View File

@ -1,7 +1,7 @@
.idea
.licenses
.vscode
dist
lib
node_modules
package-lock.json
# Ignore list
/*
# Do not ignore these folders:
!__tests__/
!.github/
!src/

10
.prettierrc.js Normal file
View File

@ -0,0 +1,10 @@
module.exports = {
printWidth: 80,
tabWidth: 2,
useTabs: false,
semi: true,
singleQuote: true,
trailingComma: 'none',
bracketSpacing: false,
arrowParens: 'avoid'
};

View File

@ -1,11 +0,0 @@
{
"printWidth": 80,
"tabWidth": 2,
"useTabs": false,
"semi": true,
"singleQuote": true,
"trailingComma": "none",
"bracketSpacing": false,
"arrowParens": "avoid",
"endOfLine": "auto"
}

4350
dist/index.js vendored

File diff suppressed because it is too large Load Diff

2916
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -6,10 +6,10 @@
"main": "lib/main.js",
"scripts": {
"build": "tsc --project tsconfig.app.json && ncc build",
"format": "prettier --write --ignore-unknown **/*.{json,yml,ts}",
"format-check": "prettier --check --ignore-unknown **/*.{json,yml,ts}",
"lint": "eslint src/**/*.ts",
"lint:fix": "eslint src/**/*.ts --fix",
"format": "prettier --no-error-on-unmatched-pattern --config ./.prettierrc.js --write **/*.{ts,yml,yaml}",
"format-check": "prettier --no-error-on-unmatched-pattern --config ./.prettierrc.js --check **/*.{ts,yml,yaml}",
"lint": "eslint --config ./.eslintrc.js **/*.ts",
"lint:fix": "eslint --config ./.eslintrc.js **/*.ts --fix",
"lint:all": "npm run format-check && npm run lint",
"lint:all:fix": "npm run format && npm run lint:fix",
"test": "jest --config ./jest.config.js",
@ -31,8 +31,8 @@
"stale"
],
"engines": {
"node": "12",
"npm": "6"
"node": "16",
"npm": "8"
},
"author": "GitHub",
"license": "MIT",
@ -47,12 +47,12 @@
"@types/lodash.deburr": "^4.1.6",
"@types/node": "^18.11.18",
"@types/semver": "^7.3.5",
"@typescript-eslint/eslint-plugin": "^5.53.0",
"@typescript-eslint/parser": "^5.52.0",
"@typescript-eslint/eslint-plugin": "^5.54.0",
"@typescript-eslint/parser": "^5.54.0",
"@vercel/ncc": "^0.28.6",
"ansi-styles": "5.2.0",
"eslint": "^7.28.0",
"eslint-plugin-github": "^4.1.2",
"eslint": "^8.35.0",
"eslint-config-prettier": "^8.6.0",
"eslint-plugin-jest": "^27.2.1",
"jest": "^29.4.1",
"jest-circus": "^29.3.1",

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,4 @@
/* eslint jest/no-identical-title: "off" */
import {DefaultProcessorOptions} from '../../__tests__/constants/default-processor-options';
import {generateIIssue} from '../../__tests__/functions/generate-iissue';
import {IIssue} from '../interfaces/issue';

View File

@ -14,7 +14,7 @@ export class Issue implements IIssue {
created_at: IsoDateString;
updated_at: IsoDateString;
readonly labels: ILabel[];
readonly pull_request: Object | null | undefined;
readonly pull_request: object | null | undefined;
readonly state: string | 'closed' | 'open';
readonly locked: boolean;
readonly milestone?: IMilestone | null;

View File

@ -1,11 +1,11 @@
// @todo improve to include the notion of team?
interface IAssignee {
type: string;
}
export interface IUserAssignee extends IAssignee {
login: string;
type: 'User' | string;
}
export type Assignee = IUserAssignee;
// @todo improve to include the notion of team?
interface IAssignee {
type: string;
}
export interface IUserAssignee extends IAssignee {
login: string;
type: 'User' | string;
}
export type Assignee = IUserAssignee;

View File

@ -1,19 +1,19 @@
import {IsoDateString} from '../types/iso-date-string';
import {Assignee} from './assignee';
import {ILabel} from './label';
import {IMilestone} from './milestone';
import {components} from '@octokit/openapi-types';
export interface IIssue {
title: string;
number: number;
created_at: IsoDateString;
updated_at: IsoDateString;
labels: ILabel[];
pull_request?: Object | null;
state: string;
locked: boolean;
milestone?: IMilestone | null;
assignees?: Assignee[] | null;
}
export type OctokitIssue = components['schemas']['issue'];
import {IsoDateString} from '../types/iso-date-string';
import {Assignee} from './assignee';
import {ILabel} from './label';
import {IMilestone} from './milestone';
import {components} from '@octokit/openapi-types';
export interface IIssue {
title: string;
number: number;
created_at: IsoDateString;
updated_at: IsoDateString;
labels: ILabel[];
pull_request?: object | null;
state: string;
locked: boolean;
milestone?: IMilestone | null;
assignees?: Assignee[] | null;
}
export type OctokitIssue = components['schemas']['issue'];