Skip to content
Draft
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
91 changes: 24 additions & 67 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,33 +1,6 @@
import playcanvasConfig from '@playcanvas/eslint-config';
import tsPlugin from '@typescript-eslint/eslint-plugin';
import typescriptParser from '@typescript-eslint/parser';
import typescriptConfig from '@playcanvas/eslint-config/typescript';
import globals from 'globals';

const tsTypeRules = {
plugins: {
'@typescript-eslint': tsPlugin
},
rules: {
'@typescript-eslint/typedef': ['error', {
parameter: true,
arrowParameter: false
}]
}
};

const importConfig = {
settings: {
'import/parsers': {
'@typescript-eslint/parser': ['.ts']
},
'import/resolver': {
typescript: {
alwaysTryTypes: true
}
}
}
};

const coreConfig = {
files: [
'src/core/**/*.ts',
Expand All @@ -37,9 +10,7 @@ const coreConfig = {
'src/launch/**/*.ts',
'src/plugins/**/*.ts'
],
plugins: tsTypeRules.plugins,
languageOptions: {
parser: typescriptParser,
globals: {
...globals.browser,
config: 'readonly',
Expand All @@ -53,103 +24,90 @@ const coreConfig = {
}
},
rules: {
...tsTypeRules.rules,
'@typescript-eslint/typedef': ['error', {
parameter: true,
arrowParameter: false
}],
'accessor-pairs': ['error', { setWithoutGet: false, getWithoutSet: false }],
'curly': ['error', 'all'],
'jsdoc/require-param': ['error', { checkDestructured: false }],
'jsdoc/require-param-type': 'off',
'jsdoc/require-returns-type': 'off',
'jsdoc/require-returns': 'off',
'no-use-before-define': 'off',
'no-var': 'off'
}
};

const workersConfig = {
files: ['src/workers/*.ts'],
plugins: tsTypeRules.plugins,
languageOptions: {
parser: typescriptParser,
globals: {
...globals.worker,
pc: 'readonly'
}
},
rules: {
...tsTypeRules.rules,
'@typescript-eslint/typedef': ['error', {
parameter: true,
arrowParameter: false
}],
'accessor-pairs': ['error', { setWithoutGet: false, getWithoutSet: false }],
'curly': ['error', 'all'],
'jsdoc/require-param': ['error', { checkDestructured: false }],
'jsdoc/require-param-type': 'off',
'jsdoc/require-returns-type': 'off',
'jsdoc/require-returns': 'off',
'no-use-before-define': 'off',
'no-var': 'off'
}
};

const serviceWorkersConfig = {
files: ['src/sw/*.ts'],
plugins: tsTypeRules.plugins,
languageOptions: {
parser: typescriptParser,
globals: {
...globals.serviceworker
}
},
rules: {
...tsTypeRules.rules,
'@typescript-eslint/typedef': ['error', {
parameter: true,
arrowParameter: false
}],
'accessor-pairs': ['error', { setWithoutGet: false, getWithoutSet: false }],
'curly': ['error', 'all'],
'jsdoc/require-param': ['error', { checkDestructured: false }],
'jsdoc/require-param-type': 'off',
'jsdoc/require-returns-type': 'off',
'jsdoc/require-returns': 'off',
'no-use-before-define': 'off',
'no-var': 'off'
}
};

const modulesConfig = {
files: ['modules/**/*.ts'],
plugins: tsTypeRules.plugins,
languageOptions: {
parser: typescriptParser,
globals: {
...globals.browser
}
},
rules: {
...tsTypeRules.rules,
'@typescript-eslint/typedef': ['error', {
parameter: true,
arrowParameter: false
}],
'accessor-pairs': ['error', { setWithoutGet: false, getWithoutSet: false }],
'curly': ['error', 'all'],
'jsdoc/require-jsdoc': 'off',
'jsdoc/require-param': 'off',
'jsdoc/require-param-type': 'off',
'jsdoc/require-returns': 'off',
'jsdoc/require-returns-type': 'off',
'no-use-before-define': 'off',
'no-var': 'off'
}
};

const testConfig = {
files: ['test/**/*.ts'],
plugins: tsTypeRules.plugins,
languageOptions: {
parser: typescriptParser,
globals: {
...globals.node
}
},
rules: {
...tsTypeRules.rules,
'@typescript-eslint/typedef': ['error', {
parameter: true,
arrowParameter: false
}],
'accessor-pairs': ['error', { setWithoutGet: false, getWithoutSet: false }],
'curly': ['error', 'all'],
'no-unused-expressions': 'off',
'jsdoc/require-param-type': 'off',
'jsdoc/require-returns-type': 'off',
'jsdoc/require-returns': 'off',
'no-use-before-define': 'off',
'no-var': 'off'
}
Expand All @@ -164,14 +122,13 @@ const esmJsConfig = {
},
rules: {
'curly': ['error', 'all'],
'import/no-named-as-default': 'off',
'import/default': 'off'
'import-x/no-named-as-default': 'off',
'import-x/default': 'off'
}
};

export default [
importConfig,
...playcanvasConfig,
...typescriptConfig,
coreConfig,
workersConfig,
serviceWorkersConfig,
Expand Down
Loading