forked from facebook/react-native-website
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.js
More file actions
166 lines (157 loc) · 4.44 KB
/
eslint.config.js
File metadata and controls
166 lines (157 loc) · 4.44 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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import {defineConfig, globalIgnores} from 'eslint/config';
import globals from 'globals';
import eslintCss from '@eslint/css';
import eslintJs from '@eslint/js';
import tsParser from '@typescript-eslint/parser';
import eslintPluginCasePolice from 'eslint-plugin-case-police';
import * as eslintPluginMdx from 'eslint-plugin-mdx';
import eslintPluginPrettier from 'eslint-plugin-prettier/recommended';
import eslintPluginYml from 'eslint-plugin-yml';
import eslintTs from 'typescript-eslint';
import eslintPluginAlex from 'eslint-plugin-alex';
export default defineConfig([
globalIgnores([
'**/.yarn',
'**/node_modules',
'packages/lint-examples/out',
'plugins/remark-snackplayer/tests/(markdown|output)',
'website/.docusaurus',
'website/build',
'website/static',
'README.md',
]),
eslintTs.configs.recommended,
...eslintPluginYml.configs['flat/standard'],
eslintPluginPrettier,
{
languageOptions: {
globals: {
...globals.jest,
...globals.node,
window: 'readonly',
document: 'readonly',
console: 'readonly',
MutationObserver: 'readonly',
},
},
},
{
files: ['**/*.{js,mjs,cjs}'],
...eslintJs.configs.recommended,
rules: {
'no-unused-vars': 'off',
},
},
{
files: ['**/*.{ts,tsx,d.ts}'],
settings: {
'import/resolver': {
typescript: {
project: 'website/tsconfig.json',
},
},
},
languageOptions: {
parser: tsParser,
parserOptions: {
sourceType: 'module',
ecmaVersion: 'es2023',
ecmaFeatures: {
jsx: true,
modules: true,
},
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
},
{
// TODO(simek): figure out SCSS linting, since `@eslint/css` does not support it yet
// @see https://github.com/eslint/css/issues/90
files: ['**/*.css'],
...eslintCss.configs.recommended,
language: 'css/css',
plugins: {
css: eslintCss,
},
rules: {
'css/no-invalid-properties': [
'error',
{
allowUnknownVariables: true,
},
],
},
},
{
files: ['**/*.{md,mdx}'],
...eslintPluginMdx.flat,
processor: eslintPluginMdx.createRemarkProcessor({
lintCodeBlocks: false,
remarkConfigPath: 'website/.remarkrc.mjs',
}),
plugins: {
alex: eslintPluginAlex,
'case-police': eslintPluginCasePolice,
},
rules: {
'alex/no-problematic-language': [
'warn',
{
ignore: [
'CODE_OF_CONDUCT.md',
// skip older blog posts
'website/blog/201*',
],
alexOptions: {
// use a "maybe" level of profanity instead of the default "unlikely"
profanitySureness: 1,
allow: [
// we frequently refer to form props by their name "disabled"
'invalid',
// unfortunately "watchman" is a library name that we depend on
'watchman-watchwoman',
// ignore rehab rule, Detox is an e2e testing library
'rehab',
// host refers to host objects in native code
'host-hostess',
// allowing this term to prevent reporting "primitive", which is a programming term
'savage',
// allowing this term, since it seems to be used not in insensitive cases
'straightforward',
// allowing those terms, since they refer to colors and the surname of one of core contributors
'black',
'white',
// allowing this term, since we use it for expressing gratitude for certain contributors
'special',
],
},
},
],
'case-police/string-check': [
'warn',
{
ignore: ['sdk', 'uri'],
dict: {
'android studio': 'Android Studio',
'apple developer': 'Apple Developer',
avd: 'AVD',
cocoapods: 'CocoaPods',
codegen: 'Codegen',
facebook: 'Facebook',
hermes: 'Hermes',
logcat: 'Logcat',
meta: 'Meta',
xcode: 'Xcode',
},
},
],
},
},
]);