3c6df95a86
Add TypeScript project references, update ESLint configs to support ESM modules, and introduce brand semantic color tokens across the web app. Add comprehensive documentation for architecture, API reference, development setup, and user guide.
90 lines
2.4 KiB
JavaScript
90 lines
2.4 KiB
JavaScript
import js from "@eslint/js";
|
|
import ts from "typescript-eslint";
|
|
import reactPlugin from "eslint-plugin-react";
|
|
import { fileURLToPath } from "url";
|
|
import path from "path";
|
|
|
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
|
|
// We have no .eslintrc, so we must define everything here.
|
|
|
|
export default ts.config(
|
|
{
|
|
ignores: ["dist/**"],
|
|
},
|
|
{
|
|
extends: [js.configs.recommended, ts.configs.recommended],
|
|
files: ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx"],
|
|
languageOptions: {
|
|
ecmaVersion: 2022,
|
|
sourceType: "module",
|
|
globals: {
|
|
// React Native globals
|
|
__DEV__: "readonly",
|
|
alert: "readonly",
|
|
console: "readonly",
|
|
document: "readonly",
|
|
navigator: "readonly",
|
|
window: "readonly",
|
|
require: "readonly",
|
|
module: "readonly",
|
|
exports: "readonly",
|
|
process: "readonly",
|
|
jest: "readonly",
|
|
describe: "readonly",
|
|
it: "readonly",
|
|
test: "readonly",
|
|
expect: "readonly",
|
|
beforeEach: "readonly",
|
|
afterEach: "readonly",
|
|
beforeAll: "readonly",
|
|
afterAll: "readonly",
|
|
},
|
|
parserOptions: {
|
|
ecmaFeatures: {
|
|
jsx: true,
|
|
},
|
|
tsconfigRootDir: path.resolve(__dirname),
|
|
},
|
|
},
|
|
plugins: {
|
|
react: reactPlugin,
|
|
},
|
|
rules: {
|
|
...js.configs.recommended.rules,
|
|
...ts.configs.recommended.rules,
|
|
// TypeScript handles type-related issues
|
|
"no-undef": "off",
|
|
"@typescript-eslint/no-explicit-any": "off",
|
|
// Allow _-prefixed parameters and variables to signal intentionally unused
|
|
"no-unused-vars": [
|
|
"warn",
|
|
{
|
|
varsIgnorePattern: "^_",
|
|
argsIgnorePattern: "^_",
|
|
caughtErrorsIgnorePattern: "^_",
|
|
},
|
|
],
|
|
"@typescript-eslint/no-unused-vars": [
|
|
"warn",
|
|
{
|
|
varsIgnorePattern: "^_",
|
|
argsIgnorePattern: "^_",
|
|
caughtErrorsIgnorePattern: "^_",
|
|
},
|
|
],
|
|
// React Native uses require() heavily
|
|
"no-var-requires": "off",
|
|
// We use React Native's StyleSheet
|
|
"react/no-unknown-property": [
|
|
"error",
|
|
{
|
|
ignore: ["flex", "justifyContent", "alignItems", "width", "height", "margin", "padding"],
|
|
},
|
|
],
|
|
// Allow console.log for debugging
|
|
"no-console": "off",
|
|
},
|
|
},
|
|
);
|