Repository navigation
Expand file tree
/
Copy path.eslintrc.js
More file actions
127 lines (124 loc) · 3.65 KB
/
Copy path.eslintrc.js
File metadata and controls
127 lines (124 loc) · 3.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
const path = require('path');
const typedocConfig = require('./docs/typedoc.json');
const VALID_CATEGORIES = typedocConfig.categoryOrder.filter((cat) => cat !== '*');
const CATEGORY_TAG_MATCH = `^(${VALID_CATEGORIES.join('|')})$`;
module.exports = {
parserOptions: {
requireConfigFile: false,
babelOptions: {
presets: ['@babel/preset-react'],
},
},
root: true,
extends: [
'@react-native',
'plugin:@cspell/recommended',
'plugin:prettier/recommended',
'plugin:markdown/recommended-legacy',
'plugin:jsdoc/recommended-typescript',
],
rules: {
'react/react-in-jsx-scope': 'off',
'prettier/prettier': [
'error',
{
quoteProps: 'consistent',
singleQuote: true,
tabWidth: 2,
trailingComma: 'es5',
useTabs: false,
},
],
'@cspell/spellchecker': [
'warn',
{
customWordListFile: path.resolve(__dirname, '.cspell-wordlist.txt'),
},
],
'camelcase': 'error',
'jsdoc/require-jsdoc': 'off',
'jsdoc/require-param': ['error', { checkDestructured: false }],
'jsdoc/check-param-names': ['error', { checkDestructured: false }],
'jsdoc/require-yields-type': 'off',
'jsdoc/require-yields-description': 'warn',
'jsdoc/check-tag-names': ['error', { definedTags: ['property'] }],
'jsdoc/match-description': [
'error',
{
contexts: ['any'],
mainDescription: false,
tags: {
category: {
message: '@category must be one of categories defined in .eslintrc.js',
match: CATEGORY_TAG_MATCH,
},
},
},
],
},
plugins: ['prettier', 'markdown', 'jsdoc'],
overrides: [
{
files: ['packages/react-native-executorch/src/constants.ts'],
rules: {
'@cspell/spellchecker': 'off',
},
},
{
files: ['packages/react-native-executorch/src/**/*.{js,jsx,ts,tsx}'],
rules: {
'no-console': 'warn',
},
},
{
// ==============================================================================
// LEGACY SUPPORT: disable v0.10 lint rules for legacy code (remove when legacy is dropped)
// ==============================================================================
files: [
'packages/react-native-executorch/legacy/**/*.{js,jsx,ts,tsx}',
'packages/bare-resource-fetcher/**/*.{js,jsx,ts,tsx}',
'packages/expo-resource-fetcher/**/*.{js,jsx,ts,tsx}',
],
rules: {
'jsdoc/match-description': 'off',
'camelcase': 'off',
'eslint-comments/no-unused-disable': 'off',
},
},
{
// The JSDoc rules exist to keep the generated API reference complete.
// Test helpers are not part of that surface, and requiring a tag per
// parameter on a three-line fixture crowds out the prose that explains
// why the fixture exists.
files: ['packages/react-native-executorch/__tests__/**/*.{ts,tsx}'],
rules: {
'jsdoc/require-param': 'off',
'jsdoc/require-param-description': 'off',
'jsdoc/require-returns': 'off',
'jsdoc/require-returns-description': 'off',
},
},
{
files: ['**/*.md'],
processor: 'markdown/markdown',
},
{
files: ['**/*.md/*.{ts,tsx}'],
rules: {
'no-console': 'off',
'react-hooks/rules-of-hooks': 'off',
'react/jsx-no-undef': 'off',
'@typescript-eslint/no-unused-vars': 'warn',
'camelcase': 'warn',
},
},
],
ignorePatterns: ['node_modules/', 'lib/', '**/build/'],
settings: {
jsdoc: {
tagNamePreference: {
typeParam: 'typeParam',
},
},
},
};