maranran / eslint-plugin-vue-a11y

Static AST checker for accessibility rules on elements in .vue
MIT License
161 stars 21 forks source link

TypeError: Cannot read property 'name' of null in tabindex-no-positive rule #14

Closed DotCoyote closed 5 years ago

DotCoyote commented 5 years ago

I get the following error in the console:

Module build failed (from ./node_modules/eslint-loader/index.js):
TypeError: Cannot read property 'name' of null
Occurred while linting /Users/***/clickdummy.component.vue:22
    at EventEmitter.VAttribute (/Users/***/node_modules/eslint-plugin-vue-a11y/lib/rules/tabindex-no-positive.js:28:40)
    at EventEmitter.emit (events.js:202:15)
    at NodeEventGenerator.applySelector (/Users/***/node_modules/vue-eslint-parser/.temp/external/src/external/node-event-generator.ts:264:26)
    at NodeEventGenerator.applySelectors (/Users/***/node_modules/vue-eslint-parser/.temp/external/src/external/node-event-generator.ts:292:22)
    at NodeEventGenerator.enterNode (/Users/***/node_modules/vue-eslint-parser/.temp/external/src/external/node-event-generator.ts:305:14)
    at traverse (/Users/***/node_modules/vue-eslint-parser/.temp/ast/src/ast/traverse.ts:72:13)
    at traverse (/Users/***/node_modules/vue-eslint-parser/.temp/ast/src/ast/traverse.ts:82:21)
    at traverse (/Users/***/node_modules/vue-eslint-parser/.temp/ast/src/ast/traverse.ts:86:13)
    at traverse (/Users/***/node_modules/vue-eslint-parser/.temp/ast/src/ast/traverse.ts:82:21)
    at traverse (/Users/***/node_modules/vue-eslint-parser/.temp/ast/src/ast/traverse.ts:82:21)
    at traverse (/Users/***/node_modules/vue-eslint-parser/.temp/ast/src/ast/traverse.ts:82:21)
    at traverseNodes (/Users/***/node_modules/vue-eslint-parser/.temp/ast/src/ast/traverse.ts:109:5)
    at scriptVisitor.Program:exit (/Users/***/node_modules/vue-eslint-parser/.temp/src/parser-services.ts:79:25)
    at listeners.(anonymous function).forEach.listener (/Users/***/node_modules/eslint/lib/util/safe-emitter.js:45:58)
    at Array.forEach (<anonymous>)
    at Object.emit (/Users/***/node_modules/eslint/lib/util/safe-emitter.js:45:38)

 @ ./###/components/index.ts 17:11-135
 @ ./###/index.ts
 @ ./###.entry.ts
 @ multi (webpack)-dev-server/client?http://0.0.0.0:3000 (webpack)/hot/dev-server.js ./###.entry.ts

.eslintrc.js

const { argv } = require('yargs');

const extendsPlugins = [];

extendsPlugins.push('airbnb-base');
extendsPlugins.push('plugin:@typescript-eslint/recommended');
extendsPlugins.push('plugin:vue/recommended');

if (argv.withA11y) {
  extendsPlugins.push('plugin:vue-a11y/base');
}

extendsPlugins.push('plugin:import/errors');
extendsPlugins.push('plugin:import/warnings');
extendsPlugins.push('prettier');
extendsPlugins.push('prettier/vue');

module.exports = {
  root: true,
  env: {
    browser: true,
    es6: true,
    jest: true,
  },
  parser: 'vue-eslint-parser',
  parserOptions: {
    parser: '@typescript-eslint/parser',
    ecmaVersion: 2017,
    sourceType: 'module',
    project: './tsconfig.json',
  },
  extends: extendsPlugins,
  plugins: ['@typescript-eslint', 'typescript', 'prettier', 'vue-a11y'],
  settings: {
    'import/resolver': {
      webpack: {
        config: './webpack/webpack.config.base.babel.js',
      },
    },
  },
  rules: {
    'import/extensions': [
      'error',
      'always',
      {
        js: 'never',
        ts: 'never',
        scss: 'never',
      },
    ],
    'import/prefer-default-export': 'off',
    'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'warn',
    'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'warn',
    '@typescript-eslint/indent': 'off',
    '@typescript-eslint/no-explicit-any': 'off',
    '@typescript-eslint/interface-name-prefix': ['error', 'always'],
    'typescript/interface-name-prefix': ['error', 'always'],

    'class-methods-use-this': 'off',
    'operator-linebreak': 'off',
    'vue/no-v-html': 'off',
  },
  overrides: [
    {
      files: ['*.test.ts'],
      rules: {
        'import/no-extraneous-dependencies': [
          'error',
          {
            devDependencies: true,
          },
        ],
      },
    },
  ],
};
meshuggie commented 5 years ago

I am getting that as well.

meshuggie commented 5 years ago

v0.0.28 does not produce the error.

maranran commented 5 years ago

fixed it in next version, thanks for your issue @meshuggie @CinKon