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
117 changes: 0 additions & 117 deletions .eslintrc.js

This file was deleted.

142 changes: 142 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
import tsParser from '@typescript-eslint/parser'
import streamr from 'eslint-config-streamr-ts'
import importPlugin from 'eslint-plugin-import'
import globals from 'globals'
import path from 'node:path'
import { fileURLToPath } from 'node:url'

const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename);

export default [
{
ignores: [
'**/generated/**',
'**/dist/**',
'**/node_modules/**'
]
},
...streamr,
importPlugin.flatConfigs.recommended,
importPlugin.flatConfigs.typescript,
{
name: 'streamr-network-typescript',
languageOptions: {
globals: globals.node,
parser: tsParser,
parserOptions: {
project: ['./tsconfig.jest.json'],
tsconfigRootDir: __dirname
}
},
settings: {
'import/resolver': {
typescript: {
alwaysTryTypes: true,
project: [
'packages/*/tsconfig.jest.json',
'packages/browser-test-runner/tsconfig.node.json'
]
},
node: true
}
},
rules: {
'class-methods-use-this': 'error',
'default-case': 'error',
'eol-last': 'error',
'no-console': ['error', {
allow: ['warn', 'error', 'info']
}],
'no-lonely-if': 'error',
'no-multi-spaces': ['error', {
ignoreEOLComments: true
}],
'no-restricted-imports': ['error', {
patterns: ['*/dist']
}],
'no-unneeded-ternary': 'error',
'no-useless-return': 'error',
'prefer-arrow-callback': 'error',
'quotes': ['error', 'single', {
allowTemplateLiterals: true
}],
'@typescript-eslint/default-param-last': 'error',
'@typescript-eslint/no-extraneous-class': 'error',
'@typescript-eslint/no-inferrable-types': 'off',
'@typescript-eslint/no-invalid-this': 'error',
'@typescript-eslint/no-invalid-void-type': 'error',
'@typescript-eslint/no-misused-promises': ['error', {
checksVoidReturn: false
}],
'@typescript-eslint/no-unused-expressions': 'error',
'@typescript-eslint/no-unused-vars': ['error', {
vars: 'all',
args: 'all',
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_'
}],
'@typescript-eslint/no-useless-constructor': 'error',
'@typescript-eslint/no-useless-empty-export': 'error',
'@typescript-eslint/parameter-properties': 'error',
'@typescript-eslint/prefer-literal-enum-member': 'error',
'@typescript-eslint/restrict-template-expressions': ['error', {
allowAny: false,
allowBoolean: true,
allowNullish: true,
allowNumber: true,
allowRegExp: true,
allowNever: true,
allow: [{ from: 'lib', name: 'Error' }]
}],
'@stylistic/brace-style': ['error', '1tbs', {
allowSingleLine: true
}],
'@stylistic/comma-spacing': 'error',
'@stylistic/func-call-spacing': 'error',
'@stylistic/keyword-spacing': 'error',
'@stylistic/member-delimiter-style': ['error', {
singleline: { delimiter: 'comma' },
multiline: { delimiter: 'none' }
}],
'@stylistic/object-curly-spacing': ['error', 'always'],
'@stylistic/space-before-blocks': 'error',
'@stylistic/space-before-function-paren': ['error', {
anonymous: 'never',
named: 'never',
asyncArrow: 'always'
}],
'@stylistic/space-infix-ops': 'error',
'import/no-extraneous-dependencies': ['error', {
devDependencies: [ 'test/**/*.ts', 'test/**/*.js'],
packageDir: ['.', '../..']
}],
'promise/always-return': ['error', {
ignoreLastCallback: true
}],
'promise/no-promise-in-callback': 'error',

// TODO in follow up PRs, select which rules we should enable and fix the code. When all recommended rules
// have been enabled, consider enabling the 'strict' preset.
'@typescript-eslint/require-await': 'off',
'@typescript-eslint/no-floating-promises': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/restrict-plus-operands': 'off',
'@typescript-eslint/unbound-method': 'off',
'@typescript-eslint/no-base-to-string': 'off',
'@typescript-eslint/no-unsafe-enum-comparison': 'off',
'@typescript-eslint/no-redundant-type-constituents': 'off'
}
},
{
files: ['**/*.js'],
languageOptions: {
sourceType: 'commonjs'
}
}
]
Loading
Loading