Files
Robot-Clash/eslint.config.js

34 lines
1.2 KiB
JavaScript
Raw Normal View History

// ESLint (flat config). `npm run lint`. Catches real bugs (undefined names, unused code, typos) - no style rules.
'use strict';
const js = require('@eslint/js');
const globals = require('globals');
// shared across the classic <script> files of the game (no modules, see CLAUDE.md)
const gameGlobals = { RC: 'writable', Kit: 'writable', THREE: 'readonly', KIT_ASSETS: 'readonly', module: 'readonly', require: 'readonly' };
module.exports = [
{
ignores: ['node_modules/**', 'server/node_modules/**', 'release/**', 'game/vendor/**', 'game/kit/**',
'launcher/**', 'sprite-generator/**', 'tools/shots/**', 'admin/**'],
},
js.configs.recommended,
{
rules: {
'no-unused-vars': ['warn', { args: 'none', caughtErrors: 'none' }],
'no-empty': ['error', { allowEmptyCatch: true }],
},
},
{
files: ['game/**/*.js', 'tools/**/*.js'],
languageOptions: { sourceType: 'script', globals: { ...globals.browser, ...gameGlobals } },
},
{
files: ['server/**/*.js', 'tests/**/*.js', 'eslint.config.js'],
languageOptions: { sourceType: 'commonjs', globals: { ...globals.node } },
},
{
files: ['**/*.mjs'],
languageOptions: { sourceType: 'module', globals: { ...globals.node } },
},
];