-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
5,929 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"extends": [ | ||
"@commitlint/config-conventional" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
tab_width = 2 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
lib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
const { overrides } = require('@1stg/eslint-config/overrides') | ||
const tsNode = require('ts-node') | ||
|
||
tsNode.register({ | ||
transpileOnly: true, | ||
compilerOptions: { | ||
module: 'commonjs', | ||
}, | ||
}) | ||
|
||
module.exports = { | ||
extends: '@1stg', | ||
overrides, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
*.log | ||
*.tsbuildinfo | ||
lib | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = require('@1stg/husky-config') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = require('@1stg/lint-staged') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
lib | ||
node_modules | ||
CHANGELOG.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"@1stg/prettier-config" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
const config = require('@1stg/prettier-config') | ||
|
||
module.exports = { | ||
...config, | ||
overrides: [ | ||
...config.overrides, | ||
{ | ||
files: '*.ts', | ||
options: { | ||
parser: 'babel', | ||
}, | ||
}, | ||
], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"plugins": [ | ||
"preset-lint-recommended", | ||
"preset-lint-markdown-style-guide", | ||
"preset-prettier" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
language: node_js | ||
|
||
node_js: --lts | ||
|
||
cache: yarn | ||
|
||
before_install: | ||
- curl -o- -L https://yarnpkg.com/install.sh | bash | ||
- export PATH="$HOME/.yarn/bin:$PATH" | ||
- git config --global user.name 'JounQin' | ||
- git config --global user.email 'admin@1stg.me' | ||
|
||
install: yarn --frozen-lockfile | ||
|
||
script: | ||
- yarn lint | ||
- yarn build | ||
|
||
deploy: | ||
provider: script | ||
skip_cleanup: true | ||
script: bash deploy.sh | ||
on: | ||
branch: master | ||
|
||
after_script: | ||
- yarn add -D @codechecks/client @codechecks/build-size-watcher | ||
- yarn codechecks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,143 @@ | ||
# remark-preset-prettier | ||
Turns off all rules that are unnecessary or might conflict with Prettier. | ||
|
||
[![Travis](https://img.shields.io/travis/com/JounQin/remark-preset-prettier.svg)](https://travis-ci.com/JounQin/remark-preset-prettier) | ||
[![Codacy Grade](https://img.shields.io/codacy/grade/d2f82a40047a4b69bcfc2e8afc73ea83)](https://www.codacy.com/app/JounQin/remark-preset-prettier) | ||
[![npm](https://img.shields.io/npm/v/remark-preset-prettier.svg)](https://www.npmjs.com/package/remark-preset-prettier) | ||
[![GitHub release](https://img.shields.io/github/release/JounQin/remark-preset-prettier)](https://github.com/JounQin/remark-preset-prettier/releases) | ||
|
||
[![David Peer](https://img.shields.io/david/peer/JounQin/remark-preset-prettier.svg)](https://david-dm.org/JounQin/remark-preset-prettier?type=peer) | ||
[![David](https://img.shields.io/david/JounQin/remark-preset-prettier.svg)](https://david-dm.org/JounQin/remark-preset-prettier) | ||
[![David Dev](https://img.shields.io/david/dev/JounQin/remark-preset-prettier.svg)](https://david-dm.org/JounQin/remark-preset-prettier?type=dev) | ||
|
||
[![Conventional Commits](https://img.shields.io/badge/conventional%20commits-1.0.0-yellow.svg)](https://conventionalcommits.org) | ||
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com) | ||
[![Code Style: Prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier) | ||
[![codechecks.io](https://raw.githubusercontent.com/codechecks/docs/master/images/badges/badge-default.svg?sanitize=true)](https://codechecks.io) | ||
|
||
> Turns off all rules that are unnecessary or might conflict with Prettier. | ||
## TOC <!-- omit in toc --> | ||
|
||
- [Disabled remark-lint plugins](#disabled-remark-lint-plugins) | ||
- [Install](#install) | ||
- [Usage](#usage) | ||
- [Via config like `.remarkrc`](#via-config-like-remarkrc) | ||
- [Via ESLint(recommended)](#via-eslintrecommended) | ||
- [Via [remark-cli][]](#via-remark-cli) | ||
- [Via Node API](#via-node-api) | ||
|
||
## Disabled remark-lint plugins | ||
|
||
1. [blank-lines-1-0-2](https://www.npmjs.com/package/remark-lint-blank-lines-1-0-2) | ||
2. [blockquote-indentation](https://www.npmjs.com/package/remark-lint-blockquote-indentation) | ||
3. [books-links](https://www.npmjs.com/package/remark-lint-books-links) | ||
4. [checkbox-character-style](https://www.npmjs.com/package/remark-lint-checkbox-character-style) | ||
5. [code-block-style](https://www.npmjs.com/package/remark-lint-code-block-style) | ||
6. [definition-case](https://www.npmjs.com/package/remark-lint-definition-case) | ||
7. [definition-spacing](https://www.npmjs.com/package/remark-lint-definition-spacing) | ||
8. [emphasis-marker](https://www.npmjs.com/package/remark-lint-emphasis-marker) | ||
9. [fenced-code-marker](https://www.npmjs.com/package/remark-lint-fenced-code-marker) | ||
10. [final-newline](https://www.npmjs.com/package/remark-lint-final-newline) | ||
11. [hard-break-spaces](https://www.npmjs.com/package/remark-lint-hard-break-spaces) | ||
12. [heading-style](https://www.npmjs.com/package/remark-lint-heading-style) | ||
13. [heading-whitespace](https://www.npmjs.com/package/remark-lint-heading-whitespace) | ||
14. [link-title-style](https://www.npmjs.com/package/remark-lint-link-title-style) | ||
15. [list-item-bullet-indent](https://www.npmjs.com/package/remark-lint-list-item-bullet-indent) | ||
16. [list-item-content-indent](https://www.npmjs.com/package/remark-lint-list-item-content-indent) | ||
17. [list-item-indent](https://www.npmjs.com/package/remark-lint-list-item-indent) | ||
18. [list-item-spacing](https://www.npmjs.com/package/remark-lint-list-item-spacing) | ||
19. [maximum-line-length](https://www.npmjs.com/package/remark-lint-maximum-line-length) | ||
20. [no-blockquote-without-marker](https://www.npmjs.com/package/remark-lint-no-blockquote-without-marker) | ||
21. [no-consecutive-blank-lines](https://www.npmjs.com/package/remark-lint-no-consecutive-blank-lines) | ||
22. [no-heading-content-indent](https://www.npmjs.com/package/remark-lint-no-heading-content-indent) | ||
23. [no-inline-padding](https://www.npmjs.com/package/remark-lint-no-inline-padding) | ||
24. [no-long-code](https://www.npmjs.com/package/remark-lint-no-long-code) | ||
25. [no-table-indentation](https://www.npmjs.com/package/remark-lint-no-table-indentation) | ||
26. [ordered-list-marker-style](https://www.npmjs.com/package/remark-lint-ordered-list-marker-style) | ||
27. [ordered-list-marker-value](https://www.npmjs.com/package/remark-lint-ordered-list-marker-value) | ||
28. [rule-style](https://www.npmjs.com/package/remark-lint-rule-style) | ||
29. [spaces-around-number](https://www.npmjs.com/package/remark-lint-spaces-around-number) | ||
30. [spaces-around-word](https://www.npmjs.com/package/remark-lint-spaces-around-word) | ||
31. [strong-marker](https://www.npmjs.com/package/remark-lint-strong-marker) | ||
32. [table-cell-padding](https://www.npmjs.com/package/remark-lint-table-cell-padding) | ||
33. [table-pipe-alignment](https://www.npmjs.com/package/remark-lint-table-pipe-alignment) | ||
34. [table-pipes](https://www.npmjs.com/package/remark-lint-table-pipes) | ||
35. [unordered-list-marker-style](https://www.npmjs.com/package/remark-lint-unordered-list-marker-style) | ||
|
||
## Install | ||
|
||
```sh | ||
# yarn | ||
yarn add -D remark-preset-prettier | ||
|
||
# npm | ||
npm i -D remark-preset-prettier | ||
``` | ||
|
||
## Usage | ||
|
||
### Via [config](https://github.com/remarkjs/remark/tree/master/packages/remark-cli) like `.remarkrc` | ||
|
||
```json | ||
{ | ||
"plugins": [ | ||
"preset-lint-consistent", | ||
"preset-lint-markdown-style-guide", | ||
"preset-lint-recommended", | ||
"preset-prettier" | ||
] | ||
} | ||
``` | ||
|
||
### Via ESLint(recommended) | ||
|
||
```jsonc | ||
{ | ||
"extends": "plugin:mdx/recommended", | ||
"overrides": [ | ||
{ | ||
"files": "*.md", | ||
"rules": { | ||
"prettier/prettier": [ | ||
2, | ||
{ | ||
"parser": "markdown" // required for `eslint-plugin-prettier` | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"files": "*.mdx", | ||
"extends": ["plugin:mdx/overrides"] | ||
} | ||
] | ||
} | ||
``` | ||
|
||
### Via [remark-cli][] | ||
|
||
```sh | ||
remark . --use preset-lint-consistent preset-lint-markdown-style-guide preset-lint-recommended preset-prettier | ||
``` | ||
|
||
[remark-cli]: https://github.com/remarkjs/remark/tree/master/packages/remark-cli | ||
|
||
### Via Node API | ||
|
||
```js | ||
const report = require('vfile-reporter') | ||
const remark = require('remark') | ||
const consistent = require('remark-preset-lint-consistent') | ||
const styleGuide = require('remark-preset-lint-markdown-style-guide') | ||
const recommended = require('remark-preset-lint-recommended') | ||
const prettier = require('remark-preset-lint-prettier') | ||
|
||
const file = remark() | ||
.use(consistent) | ||
.use(styleGuide) | ||
.use(recommended) | ||
.use(prettier) | ||
.processSync('_Hello world_') | ||
|
||
console.log(report(file)) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
checks: | ||
- name: build-size-watcher | ||
options: | ||
files: | ||
- path: 'lib/**/*.*' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
GH_BRANCH=${GH_BRANCH:-$TRAVIS_BRANCH} | ||
GH_REPO=${GH_REPO:-$TRAVIS_REPO_SLUG} | ||
|
||
git remote set-url origin "https://user:$GH_TOKEN@github.com/$GH_REPO.git" | ||
npm set //registry.npmjs.org/:_authToken "$NPM_TOKEN" | ||
|
||
git fetch origin "$GH_BRANCH":"$GH_BRANCH" | ||
git checkout "$GH_BRANCH" | ||
|
||
PKG_VERSION=$(jq -r '.version' package.json) | ||
|
||
git fetch origin v"$PKG_VERSION" || { | ||
yarn global add standard-version | ||
standard-version -a --release-as "$PKG_VERSION" | ||
git push --follow-tags origin "$GH_BRANCH" | ||
npm publish | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
{ | ||
"name": "remark-preset-prettier", | ||
"version": "0.1.0", | ||
"description": "Turns off all rules that are unnecessary or might conflict with Prettier.", | ||
"repository": "git@github.com:JounQin/remark-preset-prettier.git", | ||
"author": "JounQin <admin@1stg.me>", | ||
"license": "MIT", | ||
"main": "lib/cjs.js", | ||
"module": "lib/esm.js", | ||
"es2015": "lib/index.js", | ||
"types": "lib/index.d.ts", | ||
"files": [ | ||
"lib", | ||
"src" | ||
], | ||
"scripts": { | ||
"lint": "eslint . --ext js,md,mdx,ts", | ||
"build:ts": "tsc -b", | ||
"build:bundle": "rollup -c", | ||
"build": "rimraf lib && run-p build:*" | ||
}, | ||
"peerDependencies": { | ||
"prettier": "^1.18.2" | ||
}, | ||
"devDependencies": { | ||
"@1stg/babel-preset": "^0.5.0", | ||
"@1stg/eslint-config": "^0.6.0", | ||
"@1stg/husky-config": "^0.3.0", | ||
"@1stg/lint-staged": "^0.5.0", | ||
"@1stg/prettier-config": "^0.2.0", | ||
"@1stg/rollup-config": "^0.2.2", | ||
"@1stg/tsconfig": "^0.3.0", | ||
"@babel/core": "^7.5.5", | ||
"@commitlint/cli": "^8.1.0", | ||
"@commitlint/config-conventional": "^8.1.0", | ||
"eslint": "^6.3.0", | ||
"husky": "^3.0.4", | ||
"lint-staged": "^9.2.5", | ||
"npm-run-all": "^4.1.5", | ||
"prettier": "^1.18.2", | ||
"remark-preset-lint-markdown-style-guide": "^2.1.3", | ||
"remark-preset-lint-recommended": "^3.0.3", | ||
"remark-preset-prettier": "link:src", | ||
"rimraf": "^3.0.0", | ||
"rollup": "^1.20.3", | ||
"ts-node": "^8.3.0", | ||
"tslib": "^1.10.0", | ||
"typescript": "^3.6.2", | ||
"unified": "^8.3.2" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import config from '@1stg/rollup-config/cjs' | ||
|
||
export default config({ | ||
formats: ['cjs', 'esm'], | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { Plugin } from 'unified' | ||
|
||
export const plugins: Array<[Plugin, false]> = [] | ||
|
||
const remarkLintPlugins = [ | ||
'blank-lines-1-0-2', | ||
'blockquote-indentation', | ||
'books-links', | ||
'checkbox-character-style', | ||
'code-block-style', | ||
'definition-case', | ||
'definition-spacing', | ||
'emphasis-marker', | ||
'fenced-code-marker', | ||
'final-newline', | ||
'hard-break-spaces', | ||
'heading-style', | ||
'heading-whitespace', | ||
'link-title-style', | ||
'list-item-bullet-indent', | ||
'list-item-content-indent', | ||
'list-item-indent', | ||
'list-item-spacing', | ||
'maximum-line-length', | ||
'no-blockquote-without-marker', | ||
'no-consecutive-blank-lines', | ||
'no-heading-content-indent', | ||
'no-inline-padding', | ||
'no-long-code', | ||
'no-table-indentation', | ||
'ordered-list-marker-style', | ||
'ordered-list-marker-value', | ||
'rule-style', | ||
'spaces-around-number', | ||
'spaces-around-word', | ||
'strong-marker', | ||
'table-cell-padding', | ||
'table-pipe-alignment', | ||
'table-pipes', | ||
'unordered-list-marker-style', | ||
] | ||
|
||
remarkLintPlugins.forEach(plugin => { | ||
try { | ||
plugins.push([ | ||
// eslint-disable-next-line @typescript-eslint/no-require-imports | ||
require('remark-lint-' + plugin), | ||
false, | ||
]) | ||
} catch (e) {} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"extends": "@1stg/tsconfig", | ||
"compilerOptions": { | ||
"baseUrl": ".", | ||
"outDir": "lib", | ||
"target": "es2015" | ||
} | ||
} |
Oops, something went wrong.