Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…ss-utils into feat/update-base-middleware-to-allow-async-handlers
  • Loading branch information
notaphplover committed Jan 30, 2025
2 parents 75c703f + 4ae52d1 commit d3659a5
Show file tree
Hide file tree
Showing 82 changed files with 6,815 additions and 7,894 deletions.
78 changes: 0 additions & 78 deletions .eslintrc.json

This file was deleted.

10 changes: 1 addition & 9 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,23 +1,15 @@
src
test
src/test
typings
bundled
build
coverage
docs
wiki
bower.json
karma.conf.js
tsconfig.json
typings.json
CONTRIBUTING.md
ISSUE_TEMPLATE.md
PULL_REQUEST_TEMPLATE.md
tslint.json
wallaby.js
.travis.yml
.gitignore
.vscode
type_definitions
.eslintrc.json
.github/
13 changes: 0 additions & 13 deletions .publishrc

This file was deleted.

8 changes: 0 additions & 8 deletions .travis.yml

This file was deleted.

5 changes: 0 additions & 5 deletions eslint.config.js

This file was deleted.

177 changes: 177 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
// @ts-check

import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';
import eslintPrettierConfig from 'eslint-plugin-prettier/recommended';
import simpleImportSort from 'eslint-plugin-simple-import-sort';

/**
* @returns {import('typescript-eslint').ConfigWithExtends}
*/
function buildBaseConfig() {
return {
extends: [
eslint.configs.recommended,
...tseslint.configs.strictTypeChecked,
],
languageOptions: {
parser: tseslint.parser,
parserOptions: {
project: './tsconfig.json',
},
},
plugins: {
'@typescript-eslint': tseslint.plugin,
'simple-import-sort': simpleImportSort,
},
rules: {
'@typescript-eslint/consistent-type-definitions': ['error', 'interface'],
'@typescript-eslint/explicit-member-accessibility': [
'error',
{
overrides: {
constructors: 'no-public',
},
},
],
'@typescript-eslint/member-ordering': ['warn'],
'@typescript-eslint/naming-convention': [
'error',
{
selector: ['classProperty'],
format: ['strictCamelCase', 'UPPER_CASE', 'snake_case'],
leadingUnderscore: 'allow',
},
{
selector: 'typeParameter',
format: ['StrictPascalCase'],
prefix: ['T'],
},
{
selector: ['typeLike'],
format: ['StrictPascalCase'],
},
{
selector: ['function', 'classMethod'],
format: ['strictCamelCase'],
leadingUnderscore: 'allow',
},
{
selector: ['parameter'],
format: ['strictCamelCase'],
leadingUnderscore: 'allow',
},
{
selector: ['variableLike'],
format: ['strictCamelCase', 'UPPER_CASE', 'snake_case'],
},
],
'@typescript-eslint/no-deprecated': 'error',
'@typescript-eslint/no-duplicate-type-constituents': 'off',
'@typescript-eslint/no-dynamic-delete': 'error',
'@typescript-eslint/no-extraneous-class': 'off',
'@typescript-eslint/no-inferrable-types': 'off',
'@typescript-eslint/no-empty-interface': 'warn',
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/no-floating-promises': ['error'],
'@typescript-eslint/no-unsafe-enum-comparison': 'off',
'no-magic-numbers': 'off',
'@typescript-eslint/no-magic-numbers': [
'warn',
{
ignore: [0, 1],
ignoreArrayIndexes: true,
ignoreEnums: true,
ignoreReadonlyClassProperties: true,
},
],
'@typescript-eslint/no-require-imports': 'error',
'@typescript-eslint/no-unnecessary-type-arguments': 'off',
'@typescript-eslint/no-unused-expressions': ['error'],
'@typescript-eslint/no-useless-constructor': 'error',
'@typescript-eslint/prefer-for-of': 'error',
'@typescript-eslint/prefer-nullish-coalescing': ['off'],
'@typescript-eslint/prefer-optional-chain': 'off',
'@typescript-eslint/prefer-readonly': ['warn'],
'@typescript-eslint/promise-function-async': ['error'],
'@typescript-eslint/require-await': 'off',
'@typescript-eslint/restrict-plus-operands': [
'error',
{
skipCompoundAssignments: false,
},
],
'@typescript-eslint/typedef': [
'error',
{
arrayDestructuring: true,
arrowParameter: true,
memberVariableDeclaration: true,
objectDestructuring: true,
parameter: true,
propertyDeclaration: true,
variableDeclaration: true,
},
],
'@typescript-eslint/unified-signatures': 'error',
'@typescript-eslint/strict-boolean-expressions': 'error',
'@typescript-eslint/switch-exhaustiveness-check': [
'error',
{
considerDefaultExhaustiveForUnions: true,
},
],
'@typescript-eslint/no-unused-vars': [
'warn',
{
args: 'all',
argsIgnorePattern: '^_',
caughtErrors: 'all',
caughtErrorsIgnorePattern: '^_',
destructuredArrayIgnorePattern: '^_',
varsIgnorePattern: '^_',
ignoreRestSiblings: true,
},
],
'simple-import-sort/imports': [
'error',
{
groups: [['^\\u0000'], ['^node:'], ['^@?\\w'], ['^'], ['^\\.']],
},
],
'sort-keys': [
'error',
'asc',
{
caseSensitive: false,
natural: true,
},
],
},
};
}

const baseRules = buildBaseConfig();

const config = tseslint.config(
{
...baseRules,
files: ['**/*.ts'],
ignores: ['**/*.test.ts'],
},
{
...baseRules,
files: ['**/*.test.ts'],
rules: {
...(baseRules.rules ?? {}),
'@typescript-eslint/no-confusing-void-expression': 'off',
'@typescript-eslint/unbound-method': 'off',
'@typescript-eslint/no-magic-numbers': 'off',
},
},
/** @type {import('typescript-eslint').ConfigWithExtends} */ (
eslintPrettierConfig
),
);

export default [...config];
2 changes: 1 addition & 1 deletion jest.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
],
"rootDir": ".",
"setupFilesAfterEnv": [
"<rootDir>/test/helpers/jest.setup.ts"
"<rootDir>/src/test/helpers/jest.setup.ts"
],
"testEnvironment": "node",
"testPathIgnorePatterns": [
Expand Down
Loading

0 comments on commit d3659a5

Please sign in to comment.