eslint-plugin-react-native-accessibility
Advanced tools
Comparing version
@@ -11,5 +11,10 @@ "use strict"; | ||
exports.__esModule = true; | ||
// ---------------------------------------------------------------------------- | ||
// Rule Definition | ||
// ---------------------------------------------------------------------------- | ||
var jsx_ast_utils_1 = require("jsx-ast-utils"); | ||
var isTouchable_1 = __importDefault(require("../util/isTouchable")); | ||
var schemas_1 = require("../util/schemas"); | ||
var utils_1 = require("@typescript-eslint/utils"); | ||
var createRule = utils_1.ESLintUtils.RuleCreator(function () { return 'https://example.com/rule-docs'; }); | ||
var errorMessage = 'Missing a11y props. Expected one of: accessibilityRole OR role OR BOTH accessibilityLabel + accessibilityHint OR BOTH accessibilityActions + onAccessibilityAction'; | ||
@@ -20,7 +25,16 @@ var schema = (0, schemas_1.generateObjSchema)(); | ||
}; | ||
module.exports = { | ||
module.exports = createRule({ | ||
name: 'has-valid-accessibility-descriptors', | ||
defaultOptions: [], | ||
meta: { | ||
docs: {}, | ||
type: 'problem', | ||
docs: { | ||
description: 'Ensures that accessible components have appropriate props to communicate with assistive technologies', | ||
url: 'https://example.com/rule-docs' | ||
}, | ||
schema: [schema], | ||
fixable: 'whitespace' | ||
fixable: 'whitespace', | ||
messages: { | ||
missingA11yProps: errorMessage | ||
} | ||
}, | ||
@@ -36,2 +50,4 @@ create: function (context) { return ({ | ||
'accessible', | ||
'importantForAccessibility', | ||
'accessibilityElementsHidden', | ||
]) && | ||
@@ -41,3 +57,3 @@ !hasSpreadProps(node.attributes)) { | ||
node: node, | ||
message: errorMessage, | ||
messageId: 'missingA11yProps', | ||
fix: function (fixer) { | ||
@@ -55,2 +71,2 @@ return fixer.insertTextAfterRange( | ||
}); } | ||
}; | ||
}); |
{ | ||
"name": "eslint-plugin-react-native-accessibility", | ||
"version": "3.6.2", | ||
"version": "3.6.3", | ||
"description": "React Native specific accessibility linting rules.", | ||
@@ -15,3 +15,3 @@ "keywords": [ | ||
"type": "git", | ||
"url": "https://github.com/FormidableLabs/eslint-plugin-react-native-a11y" | ||
"url": "https://github.com/hosseinmd/eslint-plugin-react-native-accessibility" | ||
}, | ||
@@ -26,2 +26,3 @@ "main": "lib/index.js", | ||
"lint": "eslint --config .eslintrc src __tests__ scripts", | ||
"prepublishOnly": "", | ||
"pretest": "npm run lint:fix && npm run flow", | ||
@@ -28,0 +29,0 @@ "test": "npm run jest", |
@@ -1,7 +0,8 @@ | ||
[](https://commerce.nearform.com/open-source/) | ||
THis is a Fork from eslint-plugin-react-native-a11y | ||
[](https://commerce.nearform.com/open-source/) | ||
[![Maintenance Status][maintenance-image]](#maintenance-status) | ||
Eslint-plugin-react-native-a11y is a collection of React Native specific ESLint rules for identifying accessibility issues. Building upon the foundation set down by eslint-plugin-jsx-a11y, eslint-plugin-react-native-a11y detects a few of the most commonly made accessibility issues found in react native apps. These rules make it easier for your apps to be navigable by users with screen readers. | ||
eslint-plugin-react-native-accessibility is a collection of React Native specific ESLint rules for identifying accessibility issues. Building upon the foundation set down by eslint-plugin-jsx-a11y, eslint-plugin-react-native-accessibility detects a few of the most commonly made accessibility issues found in react native apps. These rules make it easier for your apps to be navigable by users with screen readers. | ||
@@ -18,13 +19,13 @@ ## Setup | ||
Next, install `eslint-plugin-react-native-a11y`: | ||
Next, install `eslint-plugin-react-native-accessibility`: | ||
```sh | ||
npm install eslint-plugin-react-native-a11y --save-dev | ||
npm install eslint-plugin-react-native-accessibility --save-dev | ||
# or | ||
yarn add eslint-plugin-react-native-a11y --dev | ||
yarn add eslint-plugin-react-native-accessibility --dev | ||
``` | ||
**Note:** If you installed ESLint globally (using the `-g` flag in npm, or the `global` prefix in yarn) then you must also install `eslint-plugin-react-native-a11y` globally. | ||
**Note:** If you installed ESLint globally (using the `-g` flag in npm, or the `global` prefix in yarn) then you must also install `eslint-plugin-react-native-accessibility` globally. | ||
@@ -87,3 +88,3 @@ ## Configuration | ||
- [no-nested-touchables](docs/rules/no-nested-touchables.md): Enforce if a view has `accessible={true}`, that there are no touchable elements inside | ||
- [has-valid-accessibility-descriptors](docs/rules/has-valid-accessibility-descriptors.md): Ensures that Touchable* components have appropriate props to communicate with assistive technologies | ||
- [has-valid-accessibility-descriptors](docs/rules/has-valid-accessibility-descriptors.md): Ensures that Touchable\* components have appropriate props to communicate with assistive technologies | ||
@@ -148,3 +149,3 @@ ### iOS | ||
eslint-plugin-react-native-a11y is licensed under the [MIT License](LICENSE.md). | ||
eslint-plugin-react-native-accessibility is licensed under the [MIT License](LICENSE.md). | ||
@@ -151,0 +152,0 @@ ### Maintenance Status |
Sorry, the diff of this file is not supported yet
1496
1.08%154
0.65%861844
-7.79%