silphius/.eslintrc.cjs
2024-11-04 16:27:31 -06:00

89 lines
1.8 KiB
JavaScript

/**
* This is intended to be a basic starting point for linting in your app.
* It relies on recommended configs out of the box for simplicity, but you can
* and should modify this configuration to best suit your team's needs.
*/
/** @type {import('eslint').Linter.Config} */
module.exports = {
root: true,
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
},
env: {
browser: true,
commonjs: true,
es6: true,
},
globals: {
WeakRef: false,
},
rules: {
'no-constant-condition': ['error', {checkLoops: false}],
},
// Base config
extends: ['eslint:recommended'],
overrides: [
// React
{
files: ['**/*.{js,jsx}'],
plugins: ['react', 'jsx-a11y'],
extends: [
'plugin:react/recommended',
'plugin:react/jsx-runtime',
'plugin:react-hooks/recommended',
'plugin:jsx-a11y/recommended',
],
settings: {
react: {
version: 'detect',
},
formComponents: ['Form'],
linkComponents: [
{name: 'Link', linkAttribute: 'to'},
{name: 'NavLink', linkAttribute: 'to'},
],
},
rules: {
'jsx-a11y/label-has-associated-control': [2, {
controlComponents: ['SliderText'],
}],
'react/prop-types': 'off',
},
},
// Node
{
files: [
'.eslintrc.cjs',
'server.js',
'app/websocket/**',
'**/.server/**',
'*.server.{js,jsx}',
'**/{build,node}.js',
'vite.config.js',
'vitest.workspace.js',
],
env: {
node: true,
},
},
// game scripts
{
files: [
'resources/**/*.js',
],
rules: {
'require-yield': 0,
},
},
],
};