Skip to content

Commit

Permalink
feat!: migrate to markuplint v3 (#103)
Browse files Browse the repository at this point in the history
  • Loading branch information
JounQin authored Apr 9, 2023
1 parent f3827b5 commit b151c64
Show file tree
Hide file tree
Showing 48 changed files with 4,362 additions and 6,853 deletions.
8 changes: 8 additions & 0 deletions .changeset/odd-actors-decide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'eslint-plugin-htm': minor
'eslint-plugin-markup': minor
'eslint-plugin-react-enhanced': minor
'eslint-plugin-text': minor
---

feat!: migrate to markuplint v3, use `type: module`
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ jobs:
strategy:
matrix:
node:
- 14
- 16
- 18
runs-on: ubuntu-latest
Expand Down
41 changes: 41 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: 'CodeQL'

on:
push:
branches: ['main']
pull_request:
branches: ['main']
schedule:
- cron: '40 13 * * 2'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [javascript]

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
queries: +security-and-quality

- name: Autobuild
uses: github/codeql-action/autobuild@v2

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: '/language:${{ matrix.language }}'
File renamed without changes.
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
coverage
dist
/auto-imports.d.ts
/packages/**/test/fixtures
File renamed without changes.
3 changes: 3 additions & 0 deletions .stylelintignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ LICENSE
*.json
*.lock
*.log
*.mts
*.pug
*.snap
*.ts
*.tsbuildinfo
*.tsx
*.txt
*.yaml
*.yml
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
- [eslint-plugin-htm](./packages/htm/CHANGELOG.md)
- [eslint-plugin-markup](./packages/markup/CHANGELOG.md)
- [eslint-plugin-react-enhanced](./packages/react-enhanced/CHANGELOG.md)
- [eslint-plugin-text](./packages/text/CHANGELOG.md)
- [eslint-plugin-utils](./packages/utils/CHANGELOG.md)
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# @unts/eslint

[![GitHub Actions](https://github.com/un-ts/eslint/workflows/CI/badge.svg)](https://github.com/un-ts/eslint/actions/workflows/ci.yml)
[![Language grade: JavaScript](https://img.shields.io/lgtm/grade/javascript/g/un-ts/eslint.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/un-ts/eslint/context:javascript)
[![Codecov](https://img.shields.io/codecov/c/gh/un-ts/eslint)](https://codecov.io/gh/un-ts/eslint)
[![type-coverage](https://img.shields.io/badge/dynamic/json.svg?label=type-coverage&prefix=%E2%89%A5&suffix=%&query=$.typeCoverage.atLeast&uri=https%3A%2F%2Fraw.githubusercontent.com%2Fun-ts%2Feslint%2Fmain%2Fpackage.json)](https://github.com/plantain-00/type-coverage)
[![GitHub release](https://img.shields.io/github/release/un-ts/eslint)](https://github.com/un-ts/eslint/releases)
Expand All @@ -23,7 +22,7 @@ This repository is a monorepo managed by [changesets][] what means we actually p
| [`eslint-plugin-htm`](/packages/htm) | An incredible ESLint plugin for HTML based on HTMLHint | [![npm](https://img.shields.io/npm/v/eslint-plugin-htm.svg)](https://www.npmjs.com/package/eslint-plugin-htm) [![View changelog](https://img.shields.io/badge/changelog-explore-brightgreen)](https://changelogs.xyz/eslint-plugin-htm) |
| [`eslint-plugin-markup`](/packages/markup) | An incredible ESLint plugin for all markup languages based on markuplint | [![npm](https://img.shields.io/npm/v/eslint-plugin-markup.svg)](https://www.npmjs.com/package/eslint-plugin-markup) [![View changelog](https://img.shields.io/badge/changelog-explore-brightgreen)](https://changelogs.xyz/eslint-plugin-markup) |
| [`eslint-plugin-react-enhanced`](/packages/react-enhanced) | An incredible ESLint plugin for @react-enhanced | [![npm](https://img.shields.io/npm/v/eslint-plugin-react-enhanced.svg)](https://www.npmjs.com/package/eslint-plugin-react-enhanced) [![View changelog](https://img.shields.io/badge/changelog-explore-brightgreen)](https://changelogs.xyz/eslint-plugin-react-enhanced) |
| [`eslint-plugin-text`](/packages/text) | An incredible ESLint plugin for retext or textlint | [![npm](https://img.shields.io/npm/v/eslint-plugin-text.svg)](https://www.npmjs.com/package/eslint-plugin-text) [![View changelog](https://img.shields.io/badge/changelog-explore-brightgreen)](https://changelogs.xyz/eslint-plugin-text) |
| [`eslint-plugin-text`](/packages/text) | An incredible ESLint plugin for retext or textlint | [![npm](https://img.shields.io/npm/v/eslint-plugin-text.svg)](https://www.npmjs.com/package/eslint-plugin-text) [![View changelog](https://img.shields.io/badge/changelog-explore-brightgreen)](https://changelogs.xyz/eslint-plugin-text) |
| [`eslint-plugin-utils`](/packages/utils) | Utilities for ESLint plugins and custom rules | [![npm](https://img.shields.io/npm/v/eslint-plugin-utils.svg)](https://www.npmjs.com/package/eslint-plugin-utils) [![View changelog](https://img.shields.io/badge/changelog-explore-brightgreen)](https://changelogs.xyz/eslint-plugin-utils) |

## Sponsors
Expand Down
20 changes: 20 additions & 0 deletions auto-imports.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/* eslint-disable */
/* prettier-ignore */
// @ts-nocheck
// Generated by unplugin-auto-import
export {}
declare global {
const afterAll: typeof import('vitest')['afterAll']
const afterEach: typeof import('vitest')['afterEach']
const assert: typeof import('vitest')['assert']
const beforeAll: typeof import('vitest')['beforeAll']
const beforeEach: typeof import('vitest')['beforeEach']
const chai: typeof import('vitest')['chai']
const describe: typeof import('vitest')['describe']
const expect: typeof import('vitest')['expect']
const it: typeof import('vitest')['it']
const suite: typeof import('vitest')['suite']
const test: typeof import('vitest')['test']
const vi: typeof import('vitest')['vi']
const vitest: typeof import('vitest')['vitest']
}
22 changes: 22 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta
http-equiv="X-UA-Compatible"
content="IE=edge"
/>
<meta
name="viewport"
content="width=device-width, initial-scale=1.0"
/>
<title>Vitery</title>
</head>
<body>
<div id="app"></div>
<script
type="module"
src="./docs/index.tsx"
></script>
</body>
</html>
73 changes: 34 additions & 39 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "@unts/eslint",
"version": "0.0.0",
"type": "module",
"description": "Incredible ESLint plugins, make ESLint greater",
"repository": "git+https://github.com/un-ts/eslint.git",
"homepage": "https://eslint-plugins.vercel.app",
Expand All @@ -13,60 +14,60 @@
"packageManager": "[email protected]",
"scripts": {
"build": "run-p build:*",
"build:r": "r -f es2015",
"build:r": "r -f cjs",
"build:ts": "tsc -b",
"clean": "rimraf coverage dist packages/*/{lib,*.tsbuildinfo}",
"dev": "yarn docs:dev",
"docs:build": "w -e docs -p --publicPath /",
"docs:dev": "w -e docs --publicPath /",
"docs:preview": "sirv dist",
"docs:build": "vite build",
"docs:dev": "vite dev",
"docs:preview": "vite serve",
"lint": "run-p lint:*",
"lint:es": "eslint . --cache -f friendly --max-warnings 10",
"lint:style": "stylelint . --cache",
"lint:ts": "tsc -p tsconfig.base.json --noEmit",
"prepare": "simple-git-hooks && yarn-deduplicate --strategy fewer || exit 0",
"release": "changeset publish",
"serve": "yarn docs:preview",
"test": "jest",
"test": "vitest run --coverage",
"typecov": "type-coverage",
"vercel-build": "yarn docs:build"
},
"devDependencies": {
"@1stg/app-config": "^7.2.1",
"@1stg/lib-config": "^10.2.1",
"@1stg/app-config": "^8.0.1",
"@1stg/lib-config": "^11.0.1",
"@changesets/changelog-github": "^0.4.8",
"@changesets/cli": "^2.24.4",
"@markuplint/rule-textlint": "^2.5.11",
"@pkgr/webpack": "^3.4.0",
"@pkgr/webpack-mdx": "^2.2.0",
"@textlint/textlint-plugin-markdown": "^12.2.3",
"@textlint/textlint-plugin-text": "^12.2.2",
"@types/eslint": "^8.4.6",
"@changesets/cli": "^2.26.1",
"@markuplint/rule-textlint": "^3.7.0",
"@mdx-js/rollup": "^2.3.0",
"@textlint/textlint-plugin-markdown": "^13.3.2",
"@textlint/textlint-plugin-text": "^13.3.2",
"@types/eslint": "^8.37.0",
"@types/htmlhint": "^1.1.2",
"@types/jest": "^29.0.0",
"@types/node": "^18.7.15",
"@types/react": "^18.0.27",
"@types/react-dom": "^18.0.10",
"@types/web": "^0.0.72",
"@types/node": "^18.15.11",
"@types/react": "^18.0.33",
"@types/react-dom": "^18.0.11",
"@types/web": "^0.0.99",
"@vitejs/plugin-react-swc": "^3.3.0",
"@vitest/coverage-istanbul": "^0.29.8",
"dictionary-en": "^3.2.0",
"github-markdown-css": "^5.1.0",
"jest": "^29.0.2",
"github-markdown-css": "^5.2.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.3.0",
"react-router-dom": "^6.10.0",
"retext-emoji": "^8.1.0",
"retext-english": "^4.1.0",
"retext-spell": "^5.3.0",
"sirv-cli": "^2.0.2",
"textlint": "^12.2.1",
"textlint-rule-max-comma": "^2.0.2",
"sass": "^1.61.0",
"textlint": "^13.3.2",
"textlint-rule-max-comma": "^3.0.1",
"textlint-rule-no-zero-width-spaces": "^1.0.1",
"textlint-rule-spellchecker": "^2.2.1",
"ts-jest": "^28.0.8",
"ts-node": "^10.9.1",
"type-coverage": "^2.22.0",
"typescript": "^4.8.2",
"yarn-deduplicate": "^6.0.0"
"type-coverage": "^2.25.0",
"typescript": "^5.0.4",
"unplugin-auto-import": "^0.15.2",
"vite": "^4.2.1",
"vitest": "^0.29.8",
"yarn-deduplicate": "^6.0.1"
},
"commitlint": {
"extends": "@1stg"
Expand All @@ -84,18 +85,12 @@
"**/lib",
"**/test/fixtures",
"**/CHANGELOG.md",
"/auto-imports.d.ts",
"!/.github",
"!/.*.js"
],
"jest": {
"preset": "ts-jest",
"collectCoverage": true,
"moduleNameMapper": {
"eslint-plugin-(.*)": "<rootDir>/packages/$1/src"
},
"modulePathIgnorePatterns": [
"<rootDir>/package.json"
]
"markuplint": {
"extends": "@1stg/markuplint-config"
},
"prettier": "@1stg/prettier-config",
"remarkConfig": {
Expand Down
15 changes: 8 additions & 7 deletions packages/htm/package.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
{
"name": "eslint-plugin-htm",
"version": "0.5.2",
"type": "module",
"description": "An incredible ESLint plugin for HTML based on HTMLHint",
"repository": "git+https://github.com/un-ts/eslint.git",
"homepage": "https://github.com/un-ts/eslint/blob/main/packages/htm",
"author": "JounQin (https://www.1stG.me) <[email protected]>",
"funding": "https://opencollective.com/unts",
"license": "MIT",
"engines": {
"node": ">=10"
"node": "^14.18.0 || >=16.0.0"
},
"main": "./lib/index.js",
"module": "./lib/index.es2015.mjs",
"main": "./lib/index.cjs",
"module": "./lib/index.js",
"exports": {
"types": "./lib/index.d.ts",
"import": "./lib/index.es2015.mjs",
"require": "./lib/index.js"
"import": "./lib/index.js",
"require": "./lib/index.cjs"
},
"es2015": "./lib/index.es2015.mjs",
"es2015": "./lib/index.js",
"types": "./lib/index.d.ts",
"files": [
"lib"
Expand All @@ -40,7 +41,7 @@
"dependencies": {
"eslint-plugin-utils": "^0.3.2",
"htmlhint": "^1.1.4",
"tslib": "^2.4.0"
"tslib": "^2.5.0"
},
"publishConfig": {
"access": "public"
Expand Down
8 changes: 4 additions & 4 deletions packages/htm/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { registerJsonMessageHandler } from 'eslint-plugin-utils'
import { Hint } from 'htmlhint/types'
import { Hint } from 'htmlhint/types.js'

export * as configs from './configs'
export * from './parser'
export * as rules from './rules'
export * as configs from './configs.js'
export * from './parser.js'
export * as rules from './rules/index.js'

registerJsonMessageHandler('htm/html', ({ evidence, rule, message }: Hint) => ({
ruleId: `htm/${rule.id}`,
Expand Down
2 changes: 1 addition & 1 deletion packages/htm/src/rules/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from './html'
export * from './html.js'
4 changes: 2 additions & 2 deletions packages/htm/test/__snapshots__/fixtures.spec.ts.snap
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`fixtures: basic.html 1`] = `
exports[`fixtures > basic.html 1`] = `
[
{
"column": 1,
Expand Down
21 changes: 11 additions & 10 deletions packages/markup/package.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
{
"name": "eslint-plugin-markup",
"version": "0.10.2",
"type": "module",
"description": "An incredible ESLint plugin for all markup languages based on markuplint",
"repository": "git+https://github.com/un-ts/eslint.git",
"homepage": "https://github.com/un-ts/eslint/blob/main/packages/markup",
"author": "JounQin (https://www.1stG.me) <[email protected]>",
"funding": "https://opencollective.com/unts",
"license": "MIT",
"engines": {
"node": "^12.20.0 || ^14.18.0 || >=16.0.0"
"node": "^14.18.0 || >=16.0.0"
},
"main": "./lib/index.js",
"module": "./lib/index.es2015.mjs",
"main": "./lib/index.cjs",
"module": "./lib/index.js",
"exports": {
"types": "./lib/index.d.ts",
"import": "./lib/index.es2015.mjs",
"require": "./lib/index.js"
"import": "./lib/index.js",
"require": "./lib/index.cjs"
},
"es2015": "./lib/index.es2015.mjs",
"es2015": "./lib/index.js",
"types": "./lib/index.d.ts",
"files": [
"lib"
Expand All @@ -38,11 +39,11 @@
"eslint": ">=5.0.0"
},
"dependencies": {
"cosmiconfig": "^7.0.1",
"cosmiconfig": "^8.1.3",
"eslint-plugin-utils": "^0.3.2",
"markuplint": "^2.10.1",
"synckit": "^0.8.4",
"tslib": "^2.4.0"
"markuplint": "^3.7.0",
"synckit": "^0.8.5",
"tslib": "^2.5.0"
},
"publishConfig": {
"access": "public"
Expand Down
8 changes: 4 additions & 4 deletions packages/markup/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import { Violation } from '@markuplint/ml-config'
import { Linter } from 'eslint'
import { registerJsonMessageHandler } from 'eslint-plugin-utils'

export * as configs from './configs'
export * from './parser'
export * from './rules'
export * as rules from './rules'
export * as configs from './configs.js'
export * from './parser.js'
export * from './rules/index.js'
export * as rules from './rules/index.js'

const SEVERITIES = ['info', 'warning', 'error'] as const

Expand Down
2 changes: 1 addition & 1 deletion packages/markup/src/rules/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from './markup'
export * from './markup.js'
Loading

0 comments on commit b151c64

Please sign in to comment.