diff --git a/.eslintrc b/.eslintrc index eea08a86c..c057784ce 100644 --- a/.eslintrc +++ b/.eslintrc @@ -26,6 +26,12 @@ { "files": ["__tests__/src/rules/*.js"], "extends": ["plugin:eslint-plugin/tests-recommended"] + }, + { + "files": ["__tests__/**/*.js"], + "env": { + "jest": true + } } ] } diff --git a/.gitignore b/.gitignore index 927b50174..41cb00a9f 100644 --- a/.gitignore +++ b/.gitignore @@ -3,8 +3,6 @@ coverage/ lib node_modules npm-debug.log -.vscode -.idea npm-shrinkwrap.json package-lock.json diff --git a/__tests__/index-test.js b/__tests__/index-test.js index 6b7e39c0a..e782b4947 100644 --- a/__tests__/index-test.js +++ b/__tests__/index-test.js @@ -1,8 +1,8 @@ -/* eslint-env jest */ /* eslint global-require: 0 */ import fs from 'fs'; import path from 'path'; +import expect from 'expect'; import plugin from '../src'; const rules = fs.readdirSync(path.resolve(__dirname, '../src/rules/')) diff --git a/__tests__/src/rules/accessible-emoji-test.js b/__tests__/src/rules/accessible-emoji-test.js index 133f1692e..bcdb42964 100644 --- a/__tests__/src/rules/accessible-emoji-test.js +++ b/__tests__/src/rules/accessible-emoji-test.js @@ -1,4 +1,3 @@ -/* eslint-env jest */ /** * @fileoverview Enforce elements are not used. * @author Ethan Cohen diff --git a/__tests__/src/rules/alt-text-test.js b/__tests__/src/rules/alt-text-test.js index 523405211..5379376fc 100644 --- a/__tests__/src/rules/alt-text-test.js +++ b/__tests__/src/rules/alt-text-test.js @@ -1,4 +1,3 @@ -/* eslint-env jest */ /** * @fileoverview Enforce all elements that require alternative text have it. * @author Ethan Cohen diff --git a/__tests__/src/rules/anchor-has-content-test.js b/__tests__/src/rules/anchor-has-content-test.js index bfa513835..77559da31 100644 --- a/__tests__/src/rules/anchor-has-content-test.js +++ b/__tests__/src/rules/anchor-has-content-test.js @@ -1,4 +1,3 @@ -/* eslint-env jest */ /** * @fileoverview Enforce anchor elements to contain accessible content. * @author Lisa Ring & Niklas Holmberg diff --git a/__tests__/src/rules/anchor-is-valid-test.js b/__tests__/src/rules/anchor-is-valid-test.js index 78da24e67..fd7f44940 100644 --- a/__tests__/src/rules/anchor-is-valid-test.js +++ b/__tests__/src/rules/anchor-is-valid-test.js @@ -1,4 +1,3 @@ -/* eslint-env jest */ /** * @fileoverview Performs validity check on anchor hrefs. Warns when anchors are used as buttons. * @author Almero Steyn diff --git a/__tests__/src/rules/aria-props-test.js b/__tests__/src/rules/aria-props-test.js index 0f19ab854..89aa9864d 100644 --- a/__tests__/src/rules/aria-props-test.js +++ b/__tests__/src/rules/aria-props-test.js @@ -1,4 +1,3 @@ -/* eslint-env jest */ /** * @fileoverview Enforce all aria-* properties are valid. * @author Ethan Cohen diff --git a/__tests__/src/rules/aria-proptypes-test.js b/__tests__/src/rules/aria-proptypes-test.js index 04bf9c58a..f9ff1c8f7 100644 --- a/__tests__/src/rules/aria-proptypes-test.js +++ b/__tests__/src/rules/aria-proptypes-test.js @@ -1,4 +1,3 @@ -/* eslint-env jest */ /** * @fileoverview Enforce ARIA state and property values are valid. * @author Ethan Cohen @@ -10,6 +9,7 @@ import { aria } from 'aria-query'; import { RuleTester } from 'eslint'; +import expect from 'expect'; import parserOptionsMapper from '../../__util__/parserOptionsMapper'; import rule from '../../../src/rules/aria-proptypes'; diff --git a/__tests__/src/rules/aria-role-test.js b/__tests__/src/rules/aria-role-test.js index 1286ad898..bc874cb7f 100644 --- a/__tests__/src/rules/aria-role-test.js +++ b/__tests__/src/rules/aria-role-test.js @@ -1,4 +1,3 @@ -/* eslint-env jest */ /** * @fileoverview Enforce aria role attribute is valid. * @author Ethan Cohen diff --git a/__tests__/src/rules/aria-unsupported-elements-test.js b/__tests__/src/rules/aria-unsupported-elements-test.js index cfc0ff08c..d34b517eb 100644 --- a/__tests__/src/rules/aria-unsupported-elements-test.js +++ b/__tests__/src/rules/aria-unsupported-elements-test.js @@ -1,4 +1,3 @@ -/* eslint-env jest */ /** * @fileoverview Enforce that elements that do not support ARIA roles, * states and properties do not have those attributes. diff --git a/__tests__/src/rules/autocomplete-valid-test.js b/__tests__/src/rules/autocomplete-valid-test.js index e89b9ce64..333f022e1 100644 --- a/__tests__/src/rules/autocomplete-valid-test.js +++ b/__tests__/src/rules/autocomplete-valid-test.js @@ -1,4 +1,3 @@ -/* eslint-env jest */ /** * @fileoverview Ensure autocomplete attribute is correct. * @author Wilco Fiers diff --git a/__tests__/src/rules/click-events-have-key-events-test.js b/__tests__/src/rules/click-events-have-key-events-test.js index 7d1328fb6..89965a57b 100644 --- a/__tests__/src/rules/click-events-have-key-events-test.js +++ b/__tests__/src/rules/click-events-have-key-events-test.js @@ -1,4 +1,3 @@ -/* eslint-env jest */ /** * @fileoverview Enforce a clickable non-interactive element has at least 1 keyboard event listener. * @author Ethan Cohen diff --git a/__tests__/src/rules/control-has-associated-label-test.js b/__tests__/src/rules/control-has-associated-label-test.js index 17482d4ea..3a285c74f 100644 --- a/__tests__/src/rules/control-has-associated-label-test.js +++ b/__tests__/src/rules/control-has-associated-label-test.js @@ -1,4 +1,3 @@ -/* eslint-env jest */ /** * @fileoverview Control elements must be associated with a text label * @author jessebeach diff --git a/__tests__/src/rules/heading-has-content-test.js b/__tests__/src/rules/heading-has-content-test.js index 7e762b1ff..e52930452 100644 --- a/__tests__/src/rules/heading-has-content-test.js +++ b/__tests__/src/rules/heading-has-content-test.js @@ -1,4 +1,3 @@ -/* eslint-env jest */ /** * @fileoverview Enforce heading (h1, h2, etc) elements contain accessible content. * @author Ethan Cohen diff --git a/__tests__/src/rules/html-has-lang-test.js b/__tests__/src/rules/html-has-lang-test.js index ff3fb25f2..61348f676 100644 --- a/__tests__/src/rules/html-has-lang-test.js +++ b/__tests__/src/rules/html-has-lang-test.js @@ -1,4 +1,3 @@ -/* eslint-env jest */ /** * @fileoverview Enforce html element has lang prop. * @author Ethan Cohen diff --git a/__tests__/src/rules/iframe-has-title-test.js b/__tests__/src/rules/iframe-has-title-test.js index ed07483e6..195fdba44 100644 --- a/__tests__/src/rules/iframe-has-title-test.js +++ b/__tests__/src/rules/iframe-has-title-test.js @@ -1,4 +1,3 @@ -/* eslint-env jest */ /** * @fileoverview Enforce iframe elements have a title attribute. * @author Ethan Cohen diff --git a/__tests__/src/rules/img-redundant-alt-test.js b/__tests__/src/rules/img-redundant-alt-test.js index a3453522f..4f862c473 100644 --- a/__tests__/src/rules/img-redundant-alt-test.js +++ b/__tests__/src/rules/img-redundant-alt-test.js @@ -1,4 +1,3 @@ -/* eslint-env jest */ /** * @fileoverview Enforce img alt attribute does not have the word image, picture, or photo. * @author Ethan Cohen diff --git a/__tests__/src/rules/interactive-supports-focus-test.js b/__tests__/src/rules/interactive-supports-focus-test.js index 4026f7efc..4f97e786d 100644 --- a/__tests__/src/rules/interactive-supports-focus-test.js +++ b/__tests__/src/rules/interactive-supports-focus-test.js @@ -1,4 +1,3 @@ -/* eslint-env jest */ /** * @fileoverview Enforce that elements with onClick handlers must be focusable. * @author Ethan Cohen diff --git a/__tests__/src/rules/label-has-associated-control-test.js b/__tests__/src/rules/label-has-associated-control-test.js index ec8002f80..e80e21fcb 100644 --- a/__tests__/src/rules/label-has-associated-control-test.js +++ b/__tests__/src/rules/label-has-associated-control-test.js @@ -1,4 +1,3 @@ -/* eslint-env jest */ /** * @fileoverview Enforce label tags have an associated control. * @author Jesse Beach diff --git a/__tests__/src/rules/label-has-for-test.js b/__tests__/src/rules/label-has-for-test.js index ae4a38703..9fffa6093 100644 --- a/__tests__/src/rules/label-has-for-test.js +++ b/__tests__/src/rules/label-has-for-test.js @@ -1,4 +1,3 @@ -/* eslint-env jest */ /** * @fileoverview Enforce label tags have htmlFor attribute. * @author Ethan Cohen diff --git a/__tests__/src/rules/lang-test.js b/__tests__/src/rules/lang-test.js index 7096bc508..6fbde3996 100644 --- a/__tests__/src/rules/lang-test.js +++ b/__tests__/src/rules/lang-test.js @@ -1,4 +1,3 @@ -/* eslint-env jest */ /** * @fileoverview Enforce lang attribute has a valid value. * @author Ethan Cohen diff --git a/__tests__/src/rules/media-has-caption-test.js b/__tests__/src/rules/media-has-caption-test.js index 665ad2fe9..0435f7803 100644 --- a/__tests__/src/rules/media-has-caption-test.js +++ b/__tests__/src/rules/media-has-caption-test.js @@ -1,4 +1,3 @@ -/* eslint-env jest */ /** * @fileoverview