Skip to content

Commit

Permalink
build: bump dependencies, use union @1stG configs, integrate with codacy
Browse files Browse the repository at this point in the history
  • Loading branch information
JounQin committed Aug 20, 2019
1 parent 3c6fd15 commit f0b3465
Show file tree
Hide file tree
Showing 17 changed files with 1,829 additions and 750 deletions.
4 changes: 2 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
const { overrides } = require('eslint-config-1stg/overrides')
const { overrides } = require('@1stg/eslint-config/overrides')

require('ts-node').register({
transpileOnly: true,
})

module.exports = {
root: true,
extends: ['1stg'],
extends: ['@1stg'],
overrides: [
...overrides,
{
Expand Down
1 change: 1 addition & 0 deletions .huskyrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('@1stg/husky-config')
1 change: 1 addition & 0 deletions .lintstagedrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('@1stg/lint-staged')
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,6 @@ deploy:
branch: develop

after_script:
- yarn add -D @codechecks/client @codechecks/build-size-watcher @codechecks/type-coverage-watcher -W
- yarn add -D @codechecks/client @codechecks/build-size-watcher @codechecks/type-coverage-watcher codacy-coverage -W
- yarn codechecks
- cat ./coverage/lcov.info | codacy-coverage
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
</p>

[![Travis](https://img.shields.io/travis/com/rx-ts/eslint-mdx.svg)](https://travis-ci.com/rx-ts/eslint-mdx)
[![Codacy Grade](https://img.shields.io/codacy/grade/4ea8225261c04837995a858676caae4b)](https://www.codacy.com/app/JounQin/eslint-mdx)
[![Codecov](https://img.shields.io/codecov/c/gh/rx-ts/eslint-mdx)](https://codecov.io/gh/rx-ts/eslint-mdx)
[![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%2Frx-ts%2Feslint-mdx%2Fmaster%2Fpackage.json)](https://github.com/plantain-00/type-coverage)
[![GitHub release](https://img.shields.io/github/release/rx-ts/eslint-mdx)](https://github.com/rx-ts/eslint-mdx/releases)
Expand Down
47 changes: 18 additions & 29 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,33 @@
"type-coverage": "type-coverage --cache --ignore-catch --detail --ignore-files *.d.ts --strict"
},
"devDependencies": {
"@1stg/babel-preset": "^0.4.2",
"@1stg/eslint-config": "^0.2.1",
"@1stg/husky-config": "^0.1.0",
"@1stg/lint-staged": "^0.2.0",
"@1stg/prettier-config": "^0.1.0",
"@1stg/tsconfig": "^0.1.0",
"@babel/core": "^7.5.5",
"@commitlint/config-conventional": "^8.1.0",
"@types/eslint": "^4.16.8",
"@types/jest": "^24.0.17",
"@types/node": "^12.7.1",
"@types/react": "^16.9.1",
"@types/eslint": "^6.1.0",
"@types/jest": "^24.0.18",
"@types/node": "^12.7.2",
"@types/react": "^16.9.2",
"@types/rebass": "^3.0.4",
"@types/unist": "^2.0.3",
"babel-eslint": "^10.0.2",
"babel-eslint": "^11.0.0-beta.0",
"commitlint": "^8.1.0",
"eslint": "^6.1.0",
"eslint-config-1stg": "^5.8.2-beta.1",
"eslint": "^6.2.1",
"eslint-formatter-friendly": "^7.0.0",
"eslint-mdx": "link:packages/eslint-mdx/src",
"eslint-plugin-mdx": "link:packages/eslint-plugin-mdx/src",
"eslint-plugin-react": "^7.14.3",
"husky": "^3.0.3",
"jest": "^24.8.0",
"husky": "^3.0.4",
"jest": "^24.9.0",
"lerna": "^3.16.4",
"lerna-changelog": "^0.8.2",
"lint-staged": "^9.2.1",
"lint-staged": "^9.2.3",
"prettier": "1.18.2",
"prettier-config-1stg": "^0.2.0",
"react": "^16.9.0",
"ts-jest": "^24.0.2",
"ts-node": "^8.3.0",
Expand All @@ -55,12 +60,6 @@
"lib",
"node_modules"
],
"husky": {
"hooks": {
"pre-commit": "lint-staged && yarn test -o",
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
},
"jest": {
"collectCoverage": true,
"coverageThreshold": {
Expand All @@ -76,20 +75,10 @@
],
"preset": "ts-jest"
},
"lint-staged": {
"*.{html,json,md,scss,yml}": [
"prettier --write",
"git add"
],
"*.{mdx,js,ts}": [
"eslint",
"git add"
]
},
"prettier": "prettier-config-1stg",
"prettier": "@1stg/prettier-config",
"renovate": {
"extends": [
"1stg"
"@1stg"
]
},
"typeCoverage": {
Expand Down
1 change: 1 addition & 0 deletions packages/eslint-mdx/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
</p>

[![Travis](https://img.shields.io/travis/com/rx-ts/eslint-mdx.svg)](https://travis-ci.com/rx-ts/eslint-mdx)
[![Codacy Grade](https://img.shields.io/codacy/grade/4ea8225261c04837995a858676caae4b)](https://www.codacy.com/app/JounQin/eslint-mdx)
[![Codecov](https://img.shields.io/codecov/c/gh/rx-ts/eslint-mdx)](https://codecov.io/gh/rx-ts/eslint-mdx)
[![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%2Frx-ts%2Feslint-mdx%2Fmaster%2Fpackage.json)](https://github.com/plantain-00/type-coverage)
[![GitHub release](https://img.shields.io/github/release/rx-ts/eslint-mdx)](https://github.com/rx-ts/eslint-mdx/releases)
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-mdx/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"eslint": ">=5.0.0"
},
"dependencies": {
"remark-mdx": "^1.2.2",
"remark-mdx": "^1.3.1",
"remark-parse": "^7.0.1"
}
}
2 changes: 2 additions & 0 deletions packages/eslint-mdx/src/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export const DEFAULT_PARSER_OPTIONS: ParserOptions = {
ecmaVersion: new Date().getUTCFullYear() as Linter.ParserOptions['ecmaVersion'],
sourceType: 'module',
tokens: true,
filePath: '__placeholder__.mdx',
}

export class Parser {
Expand Down Expand Up @@ -183,6 +184,7 @@ export class Parser {
if (!this._parser || options.parser !== this._options.parser) {
this._parser = normalizeParser(options.parser)
}
/* istanbul ignore else */
if (options.filePath) {
this._options = options
}
Expand Down
1 change: 1 addition & 0 deletions packages/eslint-plugin-mdx/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
</p>

[![Travis](https://img.shields.io/travis/com/rx-ts/eslint-mdx.svg)](https://travis-ci.com/rx-ts/eslint-mdx)
[![Codacy Grade](https://img.shields.io/codacy/grade/4ea8225261c04837995a858676caae4b)](https://www.codacy.com/app/JounQin/eslint-mdx)
[![Codecov](https://img.shields.io/codecov/c/gh/rx-ts/eslint-mdx)](https://codecov.io/gh/rx-ts/eslint-mdx)
[![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%2Frx-ts%2Feslint-mdx%2Fmaster%2Fpackage.json)](https://github.com/plantain-00/type-coverage)
[![GitHub release](https://img.shields.io/github/release/rx-ts/eslint-mdx)](https://github.com/rx-ts/eslint-mdx/releases)
Expand Down
7 changes: 0 additions & 7 deletions test/helper.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { DEFAULT_PARSER_OPTIONS, ParserOptions } from 'eslint-mdx'

import { RuleTester } from 'eslint'

export function noop<T extends unknown[] = unknown[], R = unknown>(
Expand All @@ -11,8 +9,3 @@ export function noop<T extends unknown[] = unknown[], R = unknown>(
export const parser = require.resolve('eslint-mdx')

export const ruleTester = new RuleTester()

export const parserOptions: ParserOptions = {
...DEFAULT_PARSER_OPTIONS,
filePath: 'test.mdx',
}
3 changes: 2 additions & 1 deletion test/no-unescaped-entities.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { DEFAULT_PARSER_OPTIONS as parserOptions } from 'eslint-mdx'
import { noUnescapedEntities } from 'eslint-plugin-mdx'

import { parser, parserOptions, ruleTester } from './helper'
import { parser, ruleTester } from './helper'

const filename = 'no-unescaped-entities.mdx'

Expand Down
3 changes: 2 additions & 1 deletion test/no-unused-expressions.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { noUnusedExpressions } from 'eslint-plugin-mdx'
import { DEFAULT_PARSER_OPTIONS as parserOptions } from 'eslint-mdx'

import { parser, parserOptions, ruleTester } from './helper'
import { parser, ruleTester } from './helper'

ruleTester.run('no-unused-expressions', noUnusedExpressions, {
valid: [
Expand Down
8 changes: 6 additions & 2 deletions test/parser.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ import {
parser,
normalizeParser,
ParserOptions,
DEFAULT_PARSER_OPTIONS as parserOptions,
} from 'eslint-mdx'
import { parse } from 'espree'

import { parserOptions, noop } from './helper'
import { noop } from './helper'

import { Node } from 'unist'

Expand Down Expand Up @@ -133,8 +134,11 @@ describe('parser', () => {
expect(() =>
parser.parse('<header>Header</header>', {
...parserOptions,
sourceType: null,
parser: 'babel-eslint',
sourceType: null,
babelOptions: {
configFile: require.resolve('@1stg/babel-preset/config'),
},
}),
).not.toThrow()
})
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.base.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "./node_modules/tsconfig-1stg/tsconfig.json",
"extends": "./node_modules/@1stg/tsconfig/tsconfig.json",
"compilerOptions": {
"module": "commonjs",
"outDir": "lib",
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"extends": "./tsconfig.base.json",
"exclude": ["node_modules", "packages"],
"compilerOptions": {
"incremental": false,
"noEmit": true
},
"references": [
Expand Down
Loading

0 comments on commit f0b3465

Please sign in to comment.