Skip to content

Commit

Permalink
Merge pull request #277 from alibaba/feat-webpack-eslint
Browse files Browse the repository at this point in the history
Feat webpack eslint
  • Loading branch information
soulwu authored Nov 16, 2021
2 parents 57aa093 + 5a4b846 commit 90f2f64
Show file tree
Hide file tree
Showing 19 changed files with 2,342 additions and 225 deletions.
4 changes: 4 additions & 0 deletions packages/eslint-config-dawn/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [3.1.1](https://github.com/alibaba/dawn/compare/@dawnjs/[email protected]...@dawnjs/[email protected]) (2021-11-16)

**Note:** Version bump only for package @dawnjs/eslint-config-dawn

# [3.1.0](https://github.com/alibaba/dawn/compare/@dawnjs/[email protected]...@dawnjs/[email protected]) (2021-11-12)

### Features
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-config-dawn/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dawnjs/eslint-config-dawn",
"version": "3.1.0",
"version": "3.1.1",
"description": "dawn eslint rules",
"main": "index.js",
"keywords": [
Expand Down
6 changes: 6 additions & 0 deletions packages/middleware-lint/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [3.2.0](https://github.com/alibaba/dawn/compare/@dawnjs/[email protected]...@dawnjs/[email protected]) (2021-11-16)

### Features

- add noEmit option ([49f89b6](https://github.com/alibaba/dawn/commit/49f89b6f2b2f5b00c84eac0fef49aa0be673b132))

## [3.1.3](https://github.com/alibaba/dawn/compare/@dawnjs/[email protected]...@dawnjs/[email protected]) (2021-11-12)

### Bug Fixes
Expand Down
1 change: 1 addition & 0 deletions packages/middleware-lint/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ test:
```yml
test:
- name: '@dawnjs/dn-middleware-lint'
noEmit: false # 仅准备配置文件,不执行实际 lint
autoFix: true # 默认是 true,开启 prettier 和 eslint 的自动修复
realtime: false # 默认是 false,可结合 webpack 等中间件实现开发时实时 lint
staged: false # 默认是 false,可结合 husky 等修改 precommit hook
Expand Down
4 changes: 2 additions & 2 deletions packages/middleware-lint/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dawnjs/dn-middleware-lint",
"version": "3.1.3",
"version": "3.2.0",
"description": "Dawn lint middleware",
"main": "./lib/index.js",
"scripts": {
Expand All @@ -24,7 +24,7 @@
"url": "https://github.com/alibaba/dawn.git"
},
"dependencies": {
"@dawnjs/eslint-config-dawn": "^3.1.0",
"@dawnjs/eslint-config-dawn": "^3.1.1",
"debug": "^4.3.2",
"del": "^6.0.0",
"eslint-formatter-pretty": "^4.1.0",
Expand Down
3 changes: 2 additions & 1 deletion packages/middleware-lint/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const handler: Handler = opts => {
validateOpts(opts, ctx);

const options = {
noEmit: opts.noEmit === true,
realtime: opts.realtime === true, // default false
autoFix: opts.autoFix !== false, // default true
lintStaged: opts.staged === true, // default false
Expand Down Expand Up @@ -50,7 +51,7 @@ const handler: Handler = opts => {

await prepareDeps(ctx, projectInfo);

if (!options.realtime) {
if (!options.realtime && !options.noEmit) {
await execLint({ autoFix: options.autoFix, cache: options.cache, prettier: options.prettier, projectInfo }, ctx);
}

Expand Down
2 changes: 2 additions & 0 deletions packages/middleware-lint/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import * as Dawn from "@dawnjs/types";
export interface IOpts {
/** @deprecated Please use features in webpack/rollup/vite middleware instead */
realtime: boolean;
/** Only prepare configuration */
noEmit: boolean;
/** Enable auto-fix for eslint, default is true */
autoFix: boolean;
/** Enable staged mode with lint-staged, usually run in precommit hook, default is false */
Expand Down
6 changes: 6 additions & 0 deletions packages/middleware-webpack/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [1.4.0](https://github.com/alibaba/dawn/compare/@dawnjs/[email protected]...@dawnjs/[email protected]) (2021-11-16)

### Features

- add eslint to webpack ([ecf75de](https://github.com/alibaba/dawn/commit/ecf75de199460498311b1be355818a8d86c50a4e))

## [1.3.1](https://github.com/alibaba/dawn/compare/@dawnjs/[email protected]...@dawnjs/[email protected]) (2021-11-04)

### Bug Fixes
Expand Down
98 changes: 50 additions & 48 deletions packages/middleware-webpack/README.md

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions packages/middleware-webpack/examples/basic/.dawn/pipe.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
dev:
- name: '@dawnjs/dn-middleware-lint'
realtime: true
- name: i18n
- name: $local
location: ../../lib/index.js
Expand All @@ -7,6 +9,8 @@ dev:
babel:
runtimeHelpers: true
corejs: 3
lint:
failOnError: true

dev:esbuild:
- name: i18n
Expand Down
6 changes: 6 additions & 0 deletions packages/middleware-webpack/examples/basic/.eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Do not modify "extends" & "rules".

root: true
extends: '@dawnjs/eslint-config-dawn/typescript-react'
parserOptions:
project: ./tsconfig.json
2 changes: 2 additions & 0 deletions packages/middleware-webpack/examples/basic/.prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/** !!DO NOT MODIFY THIS FILE!! */
module.exports = require('@dawnjs/eslint-config-dawn/prettierrc');
Loading

0 comments on commit 90f2f64

Please sign in to comment.