diff --git a/.eslintrc.js b/.eslintrc.js index cb856eb..0f1fb9a 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -16,7 +16,6 @@ module.exports = { '@typescript-eslint/prefer-optional-chain': 'off', '@typescript-eslint/prefer-includes': 'off', '@typescript-eslint/prefer-nullish-coalescing': 'off', - '@typescript-eslint/no-unused-vars': 'off', '@typescript-eslint/no-dynamic-delete': 'off', '@typescript-eslint/no-unused-expressions': 'off', '@typescript-eslint/restrict-plus-operands': 'off', @@ -24,7 +23,6 @@ module.exports = { 'comma-dangle': ['error', 'only-multiline'], 'no-mixed-operators': 'off', 'no-unused-expressions': 'off', - 'no-unused-vars': 'off', eqeqeq: 'off', '@typescript-eslint/semi': ['error', 'always'], semi: ['error', 'always'], diff --git a/examples/svg/script.js b/examples/svg/script.js index 16ea6e1..cb94383 100644 --- a/examples/svg/script.js +++ b/examples/svg/script.js @@ -4,8 +4,6 @@ var patch = snabbdom.init([ ]); var h = require('../../h.js').default; -var vnode; - window.addEventListener('DOMContentLoaded', () => { var container = document.getElementById('container'); var vnode = h('div', [ @@ -13,5 +11,5 @@ window.addEventListener('DOMContentLoaded', () => { h('circle', { attrs: { cx: 50, cy: 50, r: 40, stroke: 'green', 'stroke-width': 4, fill: 'yellow' } }) ]) ]); - vnode = patch(container, vnode); + patch(container, vnode); }); diff --git a/src/jsx-global.ts b/src/jsx-global.ts index 1acdc18..0b85139 100644 --- a/src/jsx-global.ts +++ b/src/jsx-global.ts @@ -1,4 +1,9 @@ -import { VNode, VNodeData } from './vnode'; +import { VNode as _VNode, VNodeData as _VNodeData } from './vnode'; + +// workaround +// https://github.com/typescript-eslint/typescript-eslint/issues/1596 +type VNode = _VNode; +type VNodeData = _VNodeData; declare global { /** diff --git a/src/snabbdom.ts b/src/snabbdom.ts index f7e593f..4bd4b7c 100644 --- a/src/snabbdom.ts +++ b/src/snabbdom.ts @@ -1,4 +1,3 @@ -/* global module, document, Node */ import { Module } from './modules/module'; import vnode, { VNode } from './vnode'; import * as is from './is'; diff --git a/src/test/jsx.tsx b/src/test/jsx.tsx index db7deee..a1b17dc 100644 --- a/src/test/jsx.tsx +++ b/src/test/jsx.tsx @@ -1,4 +1,6 @@ import { assert } from 'chai'; +// workaround linter issue +// eslint-disable-next-line @typescript-eslint/no-unused-vars import { jsx } from '../jsx'; describe('snabbdom', function () { @@ -182,6 +184,8 @@ describe('snabbdom', function () { }); it('works with a function component', function () { + // workaround linter issue + // eslint-disable-next-line @typescript-eslint/no-unused-vars const Part = ({ part }: {part: string}) => {part}; const vnode = (