Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
a6692cc074 | ||
|
ded3cf2da2 | ||
|
f1644757c8 | ||
|
a695d58bd0 | ||
|
5f05cfcfd6 | ||
|
25668d5d1c | ||
|
0cc68e6219 |
11
CHANGELOG.md
11
CHANGELOG.md
@@ -3,6 +3,17 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [0.19.1](https://github.com/antfu/eslint-config/compare/v0.19.0...v0.19.1) (2022-03-30)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* missing file, close [#76](https://github.com/antfu/eslint-config/issues/76) ([0cc68e6](https://github.com/antfu/eslint-config/commit/0cc68e6219601b09ac8e258b869f23308e073af5))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [0.19.0](https://github.com/antfu/eslint-config/compare/v0.18.9...v0.19.0) (2022-03-29)
|
# [0.19.0](https://github.com/antfu/eslint-config/compare/v0.18.9...v0.19.0) (2022-03-29)
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"packages": [
|
|
||||||
"packages/*"
|
|
||||||
],
|
|
||||||
"version": "0.19.0"
|
|
||||||
}
|
|
@@ -1,17 +1,19 @@
|
|||||||
{
|
{
|
||||||
"name": "@antfu/eslint-config-monorepo",
|
"name": "@antfu/eslint-config-monorepo",
|
||||||
|
"version": "0.19.3",
|
||||||
"private": true,
|
"private": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"author": "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)",
|
"author": "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"preinstall": "npx only-allow pnpm",
|
|
||||||
"lint": "eslint .",
|
"lint": "eslint .",
|
||||||
"release": "lerna publish --conventional-commits"
|
"prepare": "pnpm -r run stub",
|
||||||
|
"release": "bumpp package.json packages/*/package.json --commit --push --tag && pnpm -r publish --access public"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@antfu/eslint-config": "*",
|
"@antfu/eslint-config": "*",
|
||||||
|
"bumpp": "^7.1.1",
|
||||||
"eslint": "^8.12.0",
|
"eslint": "^8.12.0",
|
||||||
"lerna": "^4.0.0",
|
"eslint-plugin-antfu": "workspace:*",
|
||||||
"typescript": "^4.6.3"
|
"typescript": "^4.6.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -3,6 +3,14 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [0.19.1](https://github.com/antfu/eslint-config/compare/v0.19.0...v0.19.1) (2022-03-30)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @antfu/eslint-config
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [0.19.0](https://github.com/antfu/eslint-config/compare/v0.18.9...v0.19.0) (2022-03-29)
|
# [0.19.0](https://github.com/antfu/eslint-config/compare/v0.18.9...v0.19.0) (2022-03-29)
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@antfu/eslint-config",
|
"name": "@antfu/eslint-config",
|
||||||
"version": "0.19.0",
|
"version": "0.19.3",
|
||||||
"description": "",
|
"description": "",
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
@@ -13,8 +13,8 @@
|
|||||||
"eslint": ">=7.4.0"
|
"eslint": ">=7.4.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@antfu/eslint-config-react": "^0.19.0",
|
"@antfu/eslint-config-react": "workspace:*",
|
||||||
"@antfu/eslint-config-vue": "^0.19.0",
|
"@antfu/eslint-config-vue": "workspace:*",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.17.0",
|
"@typescript-eslint/eslint-plugin": "^5.17.0",
|
||||||
"@typescript-eslint/parser": "^5.17.0",
|
"@typescript-eslint/parser": "^5.17.0",
|
||||||
"eslint-plugin-eslint-comments": "^3.2.0",
|
"eslint-plugin-eslint-comments": "^3.2.0",
|
||||||
|
@@ -3,6 +3,17 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [0.19.1](https://github.com/antfu/eslint-config/compare/v0.19.0...v0.19.1) (2022-03-30)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* missing file, close [#76](https://github.com/antfu/eslint-config/issues/76) ([0cc68e6](https://github.com/antfu/eslint-config/commit/0cc68e6219601b09ac8e258b869f23308e073af5))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [0.19.0](https://github.com/antfu/eslint-config/compare/v0.18.9...v0.19.0) (2022-03-29)
|
# [0.19.0](https://github.com/antfu/eslint-config/compare/v0.18.9...v0.19.0) (2022-03-29)
|
||||||
|
|
||||||
|
|
||||||
|
@@ -32,10 +32,11 @@ module.exports = {
|
|||||||
plugins: [
|
plugins: [
|
||||||
'html',
|
'html',
|
||||||
'unicorn',
|
'unicorn',
|
||||||
|
'antfu',
|
||||||
],
|
],
|
||||||
settings: {
|
settings: {
|
||||||
'import/resolver': {
|
'import/resolver': {
|
||||||
node: { extensions: ['.js', '.mjs', '.ts', '.d.ts'] },
|
node: { extensions: ['.js', '.mjs'] },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
overrides: [
|
overrides: [
|
||||||
@@ -288,5 +289,8 @@ module.exports = {
|
|||||||
// yml
|
// yml
|
||||||
'yml/quotes': ['error', { prefer: 'single', avoidEscape: false }],
|
'yml/quotes': ['error', { prefer: 'single', avoidEscape: false }],
|
||||||
'yml/no-empty-document': 'off',
|
'yml/no-empty-document': 'off',
|
||||||
|
|
||||||
|
// antfu
|
||||||
|
'antfu/no-leading-newline': 'error',
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@@ -1,13 +1,13 @@
|
|||||||
{
|
{
|
||||||
"name": "@antfu/eslint-config-basic",
|
"name": "@antfu/eslint-config-basic",
|
||||||
"version": "0.19.0",
|
"version": "0.19.3",
|
||||||
"description": "",
|
"description": "",
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"author": "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)",
|
"author": "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"files": [
|
"files": [
|
||||||
"index.js"
|
"*.js"
|
||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"lint": "eslint . --config=index.js"
|
"lint": "eslint . --config=index.js"
|
||||||
@@ -16,6 +16,7 @@
|
|||||||
"eslint": ">=7.4.0"
|
"eslint": ">=7.4.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"eslint-plugin-antfu": "workspace:*",
|
||||||
"eslint-plugin-eslint-comments": "^3.2.0",
|
"eslint-plugin-eslint-comments": "^3.2.0",
|
||||||
"eslint-plugin-html": "^6.2.0",
|
"eslint-plugin-html": "^6.2.0",
|
||||||
"eslint-plugin-import": "^2.25.4",
|
"eslint-plugin-import": "^2.25.4",
|
||||||
|
9
packages/eslint-plugin-antfu/.eslintrc.json
Normal file
9
packages/eslint-plugin-antfu/.eslintrc.json
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"extends": "@antfu",
|
||||||
|
"plugins": [
|
||||||
|
"antfu"
|
||||||
|
],
|
||||||
|
"rules": {
|
||||||
|
"antfu/no-leading-newline": "error"
|
||||||
|
}
|
||||||
|
}
|
12
packages/eslint-plugin-antfu/build.config.ts
Normal file
12
packages/eslint-plugin-antfu/build.config.ts
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
import { defineBuildConfig } from 'unbuild'
|
||||||
|
|
||||||
|
export default defineBuildConfig({
|
||||||
|
entries: [
|
||||||
|
'src/index',
|
||||||
|
],
|
||||||
|
declaration: true,
|
||||||
|
clean: true,
|
||||||
|
rollup: {
|
||||||
|
emitCJS: true,
|
||||||
|
},
|
||||||
|
})
|
29
packages/eslint-plugin-antfu/package.json
Normal file
29
packages/eslint-plugin-antfu/package.json
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
"name": "eslint-plugin-antfu",
|
||||||
|
"version": "0.19.3",
|
||||||
|
"license": "MIT",
|
||||||
|
"main": "./dist/index.cjs",
|
||||||
|
"module": "./dist/index.mjs",
|
||||||
|
"types": "./dist/index.d.ts",
|
||||||
|
"exports": {
|
||||||
|
".": {
|
||||||
|
"require": "./dist/index.cjs",
|
||||||
|
"import": "./dist/index.mjs",
|
||||||
|
"types": "./dist/index.d.ts"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"dist"
|
||||||
|
],
|
||||||
|
"scripts": {
|
||||||
|
"build": "rimraf dist && unbuild",
|
||||||
|
"stub": "unbuild --stub",
|
||||||
|
"prepublishOnly": "nr build"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@typescript-eslint/utils": "^5.17.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"unbuild": "^0.7.0"
|
||||||
|
}
|
||||||
|
}
|
7
packages/eslint-plugin-antfu/src/index.ts
Normal file
7
packages/eslint-plugin-antfu/src/index.ts
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import noLeadingNewline from './rules/no-leading-newline'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
rules: {
|
||||||
|
'no-leading-newline': noLeadingNewline,
|
||||||
|
},
|
||||||
|
}
|
44
packages/eslint-plugin-antfu/src/rules/no-leading-newline.ts
Normal file
44
packages/eslint-plugin-antfu/src/rules/no-leading-newline.ts
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
import { createEslintRule } from '../utils'
|
||||||
|
|
||||||
|
export const RULE_NAME = 'no-leading-newline'
|
||||||
|
export type MessageIds = 'noLeadingNewline'
|
||||||
|
export type Options = []
|
||||||
|
|
||||||
|
export default createEslintRule<Options, MessageIds>({
|
||||||
|
name: RULE_NAME,
|
||||||
|
meta: {
|
||||||
|
type: 'problem',
|
||||||
|
docs: {
|
||||||
|
description: 'Do not allow leading newline',
|
||||||
|
recommended: 'error',
|
||||||
|
},
|
||||||
|
fixable: 'whitespace',
|
||||||
|
schema: [],
|
||||||
|
messages: {
|
||||||
|
noLeadingNewline: 'No leading newline allowed',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
defaultOptions: [],
|
||||||
|
create: (context) => {
|
||||||
|
return {
|
||||||
|
Program(node) {
|
||||||
|
const code = context.getSourceCode()
|
||||||
|
const match = code.text.match(/^[\s]+/)?.[0] || ''
|
||||||
|
if (match.includes('\n')) {
|
||||||
|
const line = match.split('\n')
|
||||||
|
context.report({
|
||||||
|
node,
|
||||||
|
loc: {
|
||||||
|
start: { line: 0, column: 0 },
|
||||||
|
end: { line: line.length - 1, column: line[line.length - 1].length },
|
||||||
|
},
|
||||||
|
messageId: 'noLeadingNewline',
|
||||||
|
fix(fixer) {
|
||||||
|
return fixer.replaceTextRange([0, match.length], '')
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
})
|
5
packages/eslint-plugin-antfu/src/utils.ts
Normal file
5
packages/eslint-plugin-antfu/src/utils.ts
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
import { ESLintUtils } from '@typescript-eslint/utils'
|
||||||
|
|
||||||
|
export const createEslintRule = ESLintUtils.RuleCreator(
|
||||||
|
ruleName => ruleName,
|
||||||
|
)
|
@@ -3,6 +3,14 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [0.19.1](https://github.com/antfu/eslint-config/compare/v0.19.0...v0.19.1) (2022-03-30)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @antfu/eslint-config-react
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [0.19.0](https://github.com/antfu/eslint-config/compare/v0.18.9...v0.19.0) (2022-03-29)
|
# [0.19.0](https://github.com/antfu/eslint-config/compare/v0.18.9...v0.19.0) (2022-03-29)
|
||||||
|
|
||||||
**Note:** Version bump only for package @antfu/eslint-config-react
|
**Note:** Version bump only for package @antfu/eslint-config-react
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@antfu/eslint-config-react",
|
"name": "@antfu/eslint-config-react",
|
||||||
"version": "0.19.0",
|
"version": "0.19.3",
|
||||||
"description": "",
|
"description": "",
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
"access": "public"
|
"access": "public"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@antfu/eslint-config-ts": "^0.19.0",
|
"@antfu/eslint-config-ts": "workspace:*",
|
||||||
"eslint-plugin-react": "^7.29.4"
|
"eslint-plugin-react": "^7.29.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
@@ -3,6 +3,14 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [0.19.1](https://github.com/antfu/eslint-config/compare/v0.19.0...v0.19.1) (2022-03-30)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @antfu/eslint-config-ts
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [0.19.0](https://github.com/antfu/eslint-config/compare/v0.18.9...v0.19.0) (2022-03-29)
|
# [0.19.0](https://github.com/antfu/eslint-config/compare/v0.18.9...v0.19.0) (2022-03-29)
|
||||||
|
|
||||||
**Note:** Version bump only for package @antfu/eslint-config-ts
|
**Note:** Version bump only for package @antfu/eslint-config-ts
|
||||||
|
@@ -4,8 +4,14 @@ const basic = require('@antfu/eslint-config-basic')
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
extends: [
|
extends: [
|
||||||
'@antfu/eslint-config-basic',
|
'@antfu/eslint-config-basic',
|
||||||
|
'plugin:import/typescript',
|
||||||
'plugin:@typescript-eslint/recommended',
|
'plugin:@typescript-eslint/recommended',
|
||||||
],
|
],
|
||||||
|
settings: {
|
||||||
|
'import/resolver': {
|
||||||
|
node: { extensions: ['.js', '.jsx', '.mjs', '.ts', '.tsx', '.d.ts'] },
|
||||||
|
},
|
||||||
|
},
|
||||||
overrides: basic.overrides,
|
overrides: basic.overrides,
|
||||||
rules: {
|
rules: {
|
||||||
'import/named': 'off',
|
'import/named': 'off',
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@antfu/eslint-config-ts",
|
"name": "@antfu/eslint-config-ts",
|
||||||
"version": "0.19.0",
|
"version": "0.19.3",
|
||||||
"description": "",
|
"description": "",
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
"typescript": ">=3.9"
|
"typescript": ">=3.9"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@antfu/eslint-config-basic": "^0.19.0",
|
"@antfu/eslint-config-basic": "workspace:*",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.17.0",
|
"@typescript-eslint/eslint-plugin": "^5.17.0",
|
||||||
"@typescript-eslint/parser": "^5.17.0"
|
"@typescript-eslint/parser": "^5.17.0"
|
||||||
},
|
},
|
||||||
|
@@ -3,6 +3,14 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [0.19.1](https://github.com/antfu/eslint-config/compare/v0.19.0...v0.19.1) (2022-03-30)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @antfu/eslint-config-vue
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [0.19.0](https://github.com/antfu/eslint-config/compare/v0.18.9...v0.19.0) (2022-03-29)
|
# [0.19.0](https://github.com/antfu/eslint-config/compare/v0.18.9...v0.19.0) (2022-03-29)
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@antfu/eslint-config-vue",
|
"name": "@antfu/eslint-config-vue",
|
||||||
"version": "0.19.0",
|
"version": "0.19.3",
|
||||||
"description": "",
|
"description": "",
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
"access": "public"
|
"access": "public"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@antfu/eslint-config-ts": "^0.19.0",
|
"@antfu/eslint-config-ts": "workspace:*",
|
||||||
"eslint-plugin-vue": "^8.5.0"
|
"eslint-plugin-vue": "^8.5.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
4491
pnpm-lock.yaml
generated
4491
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user