Paper Sats: design and print paper notes that carry sats. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
65 lines
1.9 KiB
JavaScript
65 lines
1.9 KiB
JavaScript
import { defineConfig } from 'eslint/config';
|
|
import js from '@eslint/js';
|
|
import tseslint from 'typescript-eslint';
|
|
import prettier from 'eslint-config-prettier';
|
|
import globals from 'globals';
|
|
|
|
const bannedSyntax = [
|
|
{
|
|
selector: 'JSXAttribute[name.name="dangerouslySetInnerHTML"]',
|
|
message: 'dangerouslySetInnerHTML is banned (10-security-edge-cases.md section 7).',
|
|
},
|
|
{
|
|
selector: 'CallExpression[callee.name="eval"]',
|
|
message: 'eval is banned (10-security-edge-cases.md section 7).',
|
|
},
|
|
];
|
|
|
|
export default defineConfig(
|
|
{
|
|
ignores: [
|
|
'**/node_modules/**',
|
|
'**/.next/**',
|
|
'**/.next-*/**',
|
|
'**/dist/**',
|
|
'about/**',
|
|
'design-system/**',
|
|
'**/drizzle/**',
|
|
'**/next-env.d.ts',
|
|
],
|
|
},
|
|
js.configs.recommended,
|
|
// Source files: strict and type-aware.
|
|
{
|
|
files: ['**/src/**/*.ts', '**/src/**/*.tsx'],
|
|
extends: [tseslint.configs.strictTypeChecked],
|
|
languageOptions: {
|
|
parserOptions: { projectService: true, tsconfigRootDir: import.meta.dirname },
|
|
},
|
|
rules: {
|
|
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
|
|
'@typescript-eslint/no-misused-promises': [
|
|
'error',
|
|
{ checksVoidReturn: { attributes: false } },
|
|
],
|
|
'no-restricted-syntax': ['error', ...bannedSyntax],
|
|
},
|
|
},
|
|
// Tests may assert on known fixtures with non-null assertions.
|
|
{
|
|
files: ['**/__tests__/**', '**/*.test.ts', '**/*.test.tsx', '**/e2e/**'],
|
|
rules: { '@typescript-eslint/no-non-null-assertion': 'off' },
|
|
},
|
|
// Plain JavaScript modules run in Node.
|
|
{
|
|
files: ['**/*.mjs', '**/*.cjs'],
|
|
languageOptions: { globals: globals.node },
|
|
},
|
|
// Config files at any depth: plain JavaScript rules, no type information.
|
|
{
|
|
files: ['**/*.config.{ts,mjs,js}', 'eslint.config.mjs'],
|
|
extends: [tseslint.configs.recommended],
|
|
},
|
|
prettier,
|
|
);
|