remark-lint: Many packages does not distinguish halfwidth and fullwidth characters

Initial checklist

Affected packages and versions

remark-lint-table-pipe-alignment@3.1.3

Link to runnable example

No response

Steps to reproduce

Open below with browser:

<!doctype html>
<script type="module">
import {reporter} from 'https://esm.sh/vfile-reporter@8.1.0?bundle'
import {remark} from 'https://esm.sh/remark@15.0.1?bundle'
import remarkGfm from 'https://esm.sh/remark-gfm@4.0.0?bundle'
import remarkLint from 'https://esm.sh/remark-lint@9.1.2?build'
import remarkLintTablePipeAlignment from 'https://esm.sh/remark-lint-table-pipe-alignment@3.1.3?bundle'

const file = await remark()
  .use(remarkGfm)
  .use(remarkLint)
  .use(remarkLintTablePipeAlignment)
  .process(`
False positive
--------
Below should be OK but linter will report it as error.

| Alpha | 한글 |
|-------|------|
| a     | b    |

False negative
--------
Below should be error but linter will report it as OK.

| Alpha | 한글 |
|-------|------|
| a     | b  |
`)

document.body.innerHTML = `<pre>${reporter(file)}</pre>`
</script>

Expected behavior

The first one should be fine and the second one should be an error.

16:16-16:17 warning Misaligned table fence table-pipe-alignment remark-lint

⚠ 1 warning

Actual behavior

However, the first one gives an error and the second one does not.

8:16-8:17 warning Misaligned table fence table-pipe-alignment remark-lint

⚠ 1 warning

Runtime

Node v17, Node v16, Node v14, Node v12, Deno, Electron, Other (please specify in steps to reproduce)

Package manager

npm 8, npm 7, npm 6, yarn 2, yarn 1, pnpm, Other (please specify in steps to reproduce)

OS

Windows, Linux, macOS, Other (please specify in steps to reproduce)

Build and bundle tools

Webpack, Rollup, esbuild, Parcel, Create React App, Gatsby, Next.js, Remix, Docusaurus, Snowpack, Vite, Other (please specify in steps to reproduce)

About this issue

  • Original URL
  • State: open
  • Created 4 months ago
  • Reactions: 1
  • Comments: 19 (6 by maintainers)

Commits related to this issue

Most upvoted comments

I’ve created a patch that addresses this issue as follows: https://github.com/remarkjs/remark-lint/commit/1e659c27c530c345f2a2c592b572ee15dd5ba62c

What do you think? (I didn’t know how to make it an opt-in option, so I included it in the default behavior for now)