Skip to content

Commit

Permalink
improvement(root): add typescript resolver eslint import plugin
Browse files Browse the repository at this point in the history
to fix errors with the eslint import plugin with ts files
  • Loading branch information
Mohan Raj Rajamanickam committed Apr 30, 2020
1 parent 23d4c4c commit f54b9ac
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 9 deletions.
10 changes: 9 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,18 @@ module.exports = {
'plugin:prettier/recommended',
'prettier/@typescript-eslint',
'plugin:import/typescript',
// 'plugin:import/errors', // TODO(Debug): Import resolution errors (on interfaces) even though build is working fine
'plugin:import/errors',
'plugin:import/warnings',
'plugin:eslint-comments/recommended',
],
settings: {
'import/resolver': {
// Makes plugin:import work with Typescript interfaces etc
typescript: {
alwaysTryTypes: true, // always try to resolve types under `<root>@types` directory even it doesn't contain any source code
},
},
},
rules: {
'notice/notice': [
'error',
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
"doctoc": "^1.4.0",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.11.0",
"eslint-import-resolver-typescript": "^2.0.0",
"eslint-plugin-eslint-comments": "^3.1.2",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-jest": "^23.8.2",
Expand Down
8 changes: 4 additions & 4 deletions packages/assert/src/assert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/

import axe, { ElementContext, RunOptions } from 'axe-core';
import { extended } from '@sa11y/preset-rules';
import { A11yConfig } from '@sa11y/preset-rules';
import { Formatter, a11yResultsFormatter } from '@sa11y/format';
import * as axe from 'axe-core';
import { ElementContext, RunOptions } from 'axe-core';
import { A11yConfig, extended } from '@sa11y/preset-rules';
import { a11yResultsFormatter, Formatter } from '@sa11y/format';

// Error message prefix for runtime exceptions when running axe
// TODO (refactor): Should this be exported? Can private variables be imported in tests?
Expand Down
2 changes: 1 addition & 1 deletion packages/jest/src/jest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import { assertAccessible } from '@sa11y/assert';
import { A11yConfig, extended } from '@sa11y/preset-rules';
import { extended, A11yConfig } from '@sa11y/preset-rules';
import { matcherHint } from 'jest-matcher-utils';

export const matcherHintMsg = `expected document to have no accessibility violations but found following issues: `;
Expand Down
5 changes: 2 additions & 3 deletions packages/preset-rules/__tests__/rules.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/

import axe from 'axe-core';
import { extended } from '../src';
import { recommended } from '../src';
import * as axe from 'axe-core';
import { extended, recommended } from '../src';

/**
* TODO:
Expand Down
51 changes: 51 additions & 0 deletions yarn.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f54b9ac

Please sign in to comment.