Skip to content
Merged
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
141 changes: 0 additions & 141 deletions .eslintrc.cjs

This file was deleted.

178 changes: 178 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
import js from '@eslint/js'
import tseslint from 'typescript-eslint'
import pluginN from 'eslint-plugin-n'
import pluginMocha from 'eslint-plugin-mocha'
import pluginJsdoc from 'eslint-plugin-jsdoc'
import prettierConfig from 'eslint-config-prettier'
import globals from 'globals'

/**
* Defines the AST nodes we expect to have documentation for. It includes
* most publicly defined stuff with the following exceptions:
* - No need for descriptions on Options interfaces.
* - No need to document setters.
* - No need to document protected or private.
* - No need to document inline types in function parameters.
*/
const needsDocsContexts = [
'TSInterfaceDeclaration[id.name!=/.*Options/]',
'TSTypeAliasDeclaration',
'TSEnumDeclaration',
'TSEnumMember',
'TSMethodSignature[accessibility!=/(private|protected)/]',
'ClassBody > TSPropertySignature[accessibility!=/(private|protected)/]',
'TSInterfaceBody > TSPropertySignature[accessibility!=/(private|protected)/]',
'FunctionDeclaration',
'ClassDeclaration',
'MethodDefinition[accessibility!=/(private|protected)/][kind!=/(set|constructor)/]',
'ClassBody > ClassProperty[accessibility!=/(private|protected)/]',
]

export default [
{
ignores: [
'dist/**',
'node_modules/**',
'coverage/**',
'**/*.d.ts',
'deps/**',
'scripts/**',
'tools/**',
],
},

js.configs.recommended,

...tseslint.configs.recommended,

{
files: ['lib/**/*.ts', 'test/**/*.{js,ts}'],

languageOptions: {
parser: tseslint.parser,
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
},
globals: {
...globals.node,
...globals.es2021,
...globals.mocha,
},
},

plugins: {
'@typescript-eslint': tseslint.plugin,
n: pluginN,
mocha: pluginMocha,
jsdoc: pluginJsdoc,
},

settings: {
jsdoc: {
ignorePrivate: true,
ignoreInternal: true,
},
},

rules: {
'@typescript-eslint/explicit-module-boundary-types': [
'error',
{
allowArgumentsExplicitlyTypedAsAny: true,
},
],
'@typescript-eslint/no-explicit-any': 'off',

'@typescript-eslint/no-empty-object-type': [
'error',
{
allowInterfaces: 'always',
},
],

'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_',
},
],

'n/no-unsupported-features/es-syntax': [
'error',
{
ignores: ['modules'],
},
],
'n/no-missing-import': [
'error',
{
tryExtensions: ['.js', '.ts'],
},
],
'n/no-missing-require': [
'error',
{
tryExtensions: ['.js', '.ts'],
},
],

'jsdoc/check-tag-names': [
'warn',
{
definedTags: ['category', 'internal', 'experimental'],
},
],
'jsdoc/require-jsdoc': [
'warn',
{
contexts: needsDocsContexts,
},
],
'jsdoc/require-description': [
'warn',
{
contexts: needsDocsContexts,
},
],
'jsdoc/require-description-complete-sentence': 'warn',
'jsdoc/require-returns': 'off',
'jsdoc/require-param-type': 'off',
'jsdoc/tag-lines': [
'warn',
'any',
{
startLines: 1,
},
],
'jsdoc/no-undefined-types': [
'warn',
{
definedTypes: [
'durabilityLevel',
'effectiveRoles',
'GetOptions',
'IBucketSettings',
'MutationState',
'StorageBackend',
],
},
],

'prefer-rest-params': 'off',
},
},

{
files: ['test/**/*.{js,ts}'],
rules: {
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/no-require-imports': 'off',
'jsdoc/require-jsdoc': 'off',
},
},

prettierConfig,
]
2 changes: 1 addition & 1 deletion lib/queryexecutor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ export class QueryExecutor {
let parsed: any = null
try {
parsed = JSON.parse(raw)
} catch (e) {
} catch (_e) {
return reject(
new AnalyticsError(
this._requestContext.attachErrorContext(
Expand Down
Loading
Loading