mirror of
https://github.com/inaturalist/iNaturalistReactNative.git
synced 2025-12-23 22:18:36 -05:00
416 eslint a11y (#420)
* Add eslint-plugin-react-native-a11y dependency * Do not fix warnings on eslint run * Change all a11y error rules to warnings for now * Add a11y hint to Tabs * Add a11y prop to UserIcon * Update strings.ftl * Update strings * Update README.md * Update a11y props for InlineUser * Update a11y label * Add explanation for strings
This commit is contained in:
73
.eslintrc.js
73
.eslintrc.js
@@ -10,7 +10,8 @@ module.exports = {
|
||||
extends: [
|
||||
"airbnb",
|
||||
"plugin:i18next/recommended",
|
||||
"plugin:@tanstack/eslint-plugin-query/recommended"
|
||||
"plugin:@tanstack/eslint-plugin-query/recommended",
|
||||
"plugin:react-native-a11y/ios"
|
||||
],
|
||||
plugins: [
|
||||
"module-resolver",
|
||||
@@ -28,12 +29,15 @@ module.exports = {
|
||||
"consistent-return": [2, { treatUndefinedAsUnspecified: true }],
|
||||
"func-names": 0,
|
||||
"global-require": 0,
|
||||
"i18next/no-literal-string": [2, {
|
||||
words: {
|
||||
// Minor change to the default to disallow all-caps string literals as well
|
||||
exclude: ["[0-9!-/:-@[-`{-~]+"]
|
||||
"i18next/no-literal-string": [
|
||||
2,
|
||||
{
|
||||
words: {
|
||||
// Minor change to the default to disallow all-caps string literals as well
|
||||
exclude: ["[0-9!-/:-@[-`{-~]+"]
|
||||
}
|
||||
}
|
||||
}],
|
||||
],
|
||||
// The AirBNB approach at
|
||||
// https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/imports.js#L71
|
||||
// is quite particular and forbids imports of devDependencies anywhere
|
||||
@@ -45,22 +49,30 @@ module.exports = {
|
||||
// raise alarms when you try to import things not declared in
|
||||
// package.json.
|
||||
"import/no-extraneous-dependencies": ["error", {}],
|
||||
"max-len": ["error", 100, 2, {
|
||||
ignoreUrls: true,
|
||||
ignoreComments: false,
|
||||
ignoreRegExpLiterals: true,
|
||||
ignoreStrings: false,
|
||||
ignoreTemplateLiterals: false
|
||||
}],
|
||||
"max-len": [
|
||||
"error",
|
||||
100,
|
||||
2,
|
||||
{
|
||||
ignoreUrls: true,
|
||||
ignoreComments: false,
|
||||
ignoreRegExpLiterals: true,
|
||||
ignoreStrings: false,
|
||||
ignoreTemplateLiterals: false
|
||||
}
|
||||
],
|
||||
"no-alert": 0,
|
||||
"no-underscore-dangle": 0,
|
||||
"no-unused-vars": ["error", {
|
||||
vars: "all",
|
||||
args: "after-used",
|
||||
// Overriding airbnb to allow leading underscore to indicate unused var
|
||||
argsIgnorePattern: "^_",
|
||||
ignoreRestSiblings: true
|
||||
}],
|
||||
"no-unused-vars": [
|
||||
"error",
|
||||
{
|
||||
vars: "all",
|
||||
args: "after-used",
|
||||
// Overriding airbnb to allow leading underscore to indicate unused var
|
||||
argsIgnorePattern: "^_",
|
||||
ignoreRestSiblings: true
|
||||
}
|
||||
],
|
||||
"no-void": 0,
|
||||
"prefer-destructuring": [2, { object: true, array: false }],
|
||||
quotes: [2, "double"],
|
||||
@@ -76,7 +88,10 @@ module.exports = {
|
||||
"react/prop-types": 0,
|
||||
"react/destructuring-assignment": 0,
|
||||
"react/jsx-filename-extension": 0,
|
||||
"react/function-component-definition": [2, { namedComponents: "arrow-function" }],
|
||||
"react/function-component-definition": [
|
||||
2,
|
||||
{ namedComponents: "arrow-function" }
|
||||
],
|
||||
"react/require-default-props": 0,
|
||||
|
||||
// React-Hooks Plugin
|
||||
@@ -87,7 +102,21 @@ module.exports = {
|
||||
"react-native/no-inline-styles": "error",
|
||||
|
||||
"simple-import-sort/imports": "error",
|
||||
"simple-import-sort/exports": "error"
|
||||
"simple-import-sort/exports": "error",
|
||||
"react-native-a11y/has-accessibility-hint": 1,
|
||||
"react-native-a11y/has-accessibility-props": 1,
|
||||
"react-native-a11y/has-valid-accessibility-actions": 1,
|
||||
"react-native-a11y/has-valid-accessibility-role": 1,
|
||||
"react-native-a11y/has-valid-accessibility-state": 1,
|
||||
"react-native-a11y/has-valid-accessibility-states": 1,
|
||||
"react-native-a11y/has-valid-accessibility-component-type": 1,
|
||||
"react-native-a11y/has-valid-accessibility-traits": 1,
|
||||
"react-native-a11y/has-valid-accessibility-value": 1,
|
||||
"react-native-a11y/no-nested-touchables": 1,
|
||||
"react-native-a11y/has-valid-accessibility-descriptors": 1,
|
||||
"react-native-a11y/has-valid-accessibility-ignores-invert-colors": 1,
|
||||
"react-native-a11y/has-valid-accessibility-live-region": 1,
|
||||
"react-native-a11y/has-valid-important-for-accessibility": 1
|
||||
},
|
||||
// need this so jest doesn't show as undefined in jest.setup.js
|
||||
env: {
|
||||
|
||||
Reference in New Issue
Block a user