UNPKG

@sylphlab/eslint-config-sylph-rn

Version:
1 lines 2.86 kB
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import reactNativePlugin from 'eslint-plugin-react-native';\nimport { react as reactBaseConfig } from '@sylphlab/eslint-config-sylph-react'; // Import the React config array\nimport type { Linter } from 'eslint';\n\n// Define type alias for FlatConfig for better readability\ntype Config = Linter.Config; // Use Linter.Config instead of deprecated Linter.FlatConfig\n\n/**\n * Sylph ESLint Configuration for React Native Projects (Flat Config)\n *\n * Extends the @sylphlab/eslint-config-sylph-react configuration with\n * rules specific to React Native.\n */\nexport const rn: Config[] = [\n // Explicitly type the constant\n // 1. Inherit React Configuration (which includes the base config)\n ...reactBaseConfig,\n\n // 2. React Native Specific Configuration\n {\n files: ['**/*.{js,jsx,ts,tsx}'], // Apply RN rules broadly\n plugins: {\n 'react-native': reactNativePlugin as any,\n },\n languageOptions: {\n globals: {\n // React Native specific globals (if any not covered by plugin)\n // e.g., __DEV__: 'readonly',\n },\n },\n rules: {\n // --- React Native Plugin Recommended Rules ---\n // Manually include rules from the plugin's recommended set\n ...reactNativePlugin.configs.all.rules, // Start with 'all' and override below\n\n // --- Rule Overrides & Additions for React Native ---\n 'react-native/no-unused-styles': 'error',\n 'react-native/split-platform-components': 'warn', // Warn, don't error yet\n 'react-native/no-inline-styles': 'warn', // Warn, allow for quick prototyping\n 'react-native/no-color-literals': 'warn', // Warn, encourage theme usage\n 'react-native/no-raw-text': ['error', { skip: ['CustomTextComponent'] }], // Enforce text components, allow exceptions\n 'react-native/sort-styles': 'off', // Let Prettier handle style sorting if desired via plugins\n\n // --- Adjust base/react rules for RN context ---\n // Example: Relax console usage slightly more in RN dev?\n // 'no-console': ['warn', { allow: ['warn', 'error', 'info', 'debug'] }],\n },\n },\n]; // Remove satisfies\n\n// Export the config directly\nexport default rn;\n"],"mappings":"0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,EAAA,OAAAC,IAAA,eAAAC,EAAAJ,GAAA,IAAAK,EAA8B,2CAC9BC,EAAyC,+CAY5BH,EAAe,CAG1B,GAAG,EAAAI,MAGH,CACE,MAAO,CAAC,sBAAsB,EAC9B,QAAS,CACP,eAAgB,EAAAC,OAClB,EACA,gBAAiB,CACf,QAAS,CAGT,CACF,EACA,MAAO,CAGL,GAAG,EAAAA,QAAkB,QAAQ,IAAI,MAGjC,gCAAiC,QACjC,yCAA0C,OAC1C,gCAAiC,OACjC,iCAAkC,OAClC,2BAA4B,CAAC,QAAS,CAAE,KAAM,CAAC,qBAAqB,CAAE,CAAC,EACvE,2BAA4B,KAK9B,CACF,CACF,EAGON,EAAQC","names":["index_exports","__export","index_default","rn","__toCommonJS","import_eslint_plugin_react_native","import_eslint_config_sylph_react","reactBaseConfig","reactNativePlugin"]}