Skip to content

feat: restart @ice/spec and update version to v2 #58

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions .eslintignore

This file was deleted.

17 changes: 0 additions & 17 deletions .eslintrc.js

This file was deleted.

15 changes: 9 additions & 6 deletions .github/workflows/auto-publisher.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,18 @@ jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
- uses: actions/checkout@v3
- name: Install pnpm
uses: pnpm/action-setup@v2
- uses: actions/setup-node@v4
with:
node-version: 10
node-version: 18
cache: 'pnpm'
registry-url: https://registry.npmjs.org/
- run: |
npm i
npm run setup
npm run publish
pnpm i
pnpm run build
pnpm release
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
REGISTRY: https://registry.npmjs.org
33 changes: 33 additions & 0 deletions .github/workflows/beta-publisher.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Beta Publisher

on:
workflow_dispatch:
inputs:
tag:
description: 'Tag'
required: true
options:
- rc
- beta
- alpha

jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v2
- uses: actions/setup-node@v4
with:
node-version: 18
cache: 'pnpm'
registry-url: https://registry.npmjs.org/
- name: Build and Run
run: |
pnpm i
pnpm run build
pnpm publish --tag ${{inputs.tag}} -r --no-git-checks
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
REGISTRY: https://registry.npmjs.org
11 changes: 7 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Install pnpm
uses: pnpm/action-setup@v2
- uses: actions/setup-node@v1
with:
node-version: 10
node-version: 18
registry-url: https://registry.npmjs.org/
- run: npm i
- run: npm run ci

- run: pnpm i
- run: pnpm build
- run: pnpm run lint
- run: pnpm run test
23 changes: 23 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Pull Request Check

on:
pull_request:

jobs:
publish-pkg:
if: false # Temp disable
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v2
- uses: actions/setup-node@v4
with:
node-version: 18
cache: 'pnpm'
- name: Setup
run: |
pnpm i
pnpm run build
- name: pkg.new
run: pnpx pkg-pr-new publish './packages/*'
13 changes: 7 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,17 @@ es/
lib/
dist/
build/
esm/
es2017/
coverage/
node_modules/
examples/test
.idea/
.history/
packages/**/lib/
packages/**/dist/
packages/**/build/
packages/**/coverage/
packages/**/node_modules/
packages/*/lib/
packages/*/dist/
packages/*/build/
packages/*/coverage/

package-lock.json
yarn.lock
yarn.lock
3 changes: 1 addition & 2 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx --no-install commitlint --edit "$1"
#npx --no-install commitlint --edit "$1"
4 changes: 1 addition & 3 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm run lint && npm run test
lint-staged
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
registry=https://registry.npmjs.org/
4 changes: 2 additions & 2 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
const { getPrettierConfig } = require('./packages/spec/src/');
import { config } from '@ice/spec/prettier';

module.exports = getPrettierConfig('react');
export default config;
27 changes: 14 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# @iceworks/spec
# @ice/spec

Easy to use **eslint**(support TypeScript) / **stylelint** / **prettier** / **commitlint** in [rax](https://rax.js.org/), [ice](https://ice.work/) and react project. And spec means specification.
Easy to use **eslint**(support TypeScript) / **stylelint** / **prettier** / **commitlint** in [ice](https://ice.work/) and react project. And spec means specification.

## Install

```bash
$ npm i --save-dev @iceworks/spec eslint stylelint prettier @commitlint/cli
$ npm i --save-dev @ice/spec eslint stylelint prettier @commitlint/cli
```

PS: You don't need to install other eslint plugins and parsers.
Expand All @@ -14,20 +14,21 @@ PS: You don't need to install other eslint plugins and parsers.

### ESLint

> NOTE: from @ice/spec 2.0.0, it's requires eslint >= 8.(support flat config)

#### 1. Create configuration file

First create a `.eslintrc.js` file. Then edit your config.
First create a `eslint.config.js` file. Then edit your config.

#### 2. Update config

[rules](https://github.com/ice-lab/spec/tree/master/packages/spec/src/eslint/react.js) base on [eslint-config-ali](https://www.npmjs.com/package/eslint-config-ali) and [@iceworks/eslint-plugin-best-practices](https://www.npmjs.com/package/@iceworks/eslint-plugin-best-practices).

```js
// .eslintrc.js
const { getESLintConfig } = require('@iceworks/spec');
// eslint.config.js
import { getESLintConfig } from '@ice/spec/eslint';

// getESLintConfig(rule: 'common'|'rax'|'react'|'vue', customConfig?);
module.exports = getESLintConfig('react');
export default getESLintConfig();
```

### stylelint
Expand All @@ -42,7 +43,7 @@ First create a `.stylelintrc.js` file. Then edit your config.

```js
// .stylelintrc.js
const { getStylelintConfig } = require('@iceworks/spec');
const { getStylelintConfig } = require('@ice/spec/stylelint');

// getStylelintConfig(rule: 'common'|'rax'|'react'|'vue', customConfig?);
module.exports = getStylelintConfig('react');
Expand All @@ -58,10 +59,10 @@ First create a `.prettierrc.js` file. Then edit your config.

```js
// .prettierrc.js
const { getPrettierConfig } = require('@iceworks/spec');
const { getPrettierConfig } = require('@ice/spec/prettier');

// getPrettierConfig(rule: 'common'|'rax'|'react'|'vue', customConfig?);
module.exports = getPrettierConfig('react');
module.exports = getPrettierConfig();
```

### commitlint
Expand Down Expand Up @@ -101,7 +102,7 @@ module.exports = getESLintConfig('rax', {

### package.json scripts

Add `scripts` in your `package.json`, example:
Add `scripts` in your `package.json`, example:

```json
"scripts": {
Expand All @@ -126,7 +127,7 @@ After that, we recommend you to see [husky docs](https://www.npmjs.com/package/h

If you are using [@ice/spec](https://www.npmjs.com/package/@ice/spec) in your project, we recommend use `@iceworks/spec` to get better maintainability and faster response to lint rules support.

Based on `@iceworks/spec`'s simple API you can quickly migrate your project, install and update your lint config file, the mission is completed 😁.
Based on `@iceworks/spec`'s simple API you can quickly migrate your project, install and update your lint config file, the mission is completed 😁.

## Develop

Expand Down
7 changes: 4 additions & 3 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const { getCommitlintConfig } = require('./packages/spec/src/');

module.exports = getCommitlintConfig('react');
// const { getCommitlintConfig } = require('./packages/spec/src/');
//
// module.exports = getCommitlintConfig('react');
export default {};
11 changes: 11 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import eslint from '@ice/spec/eslint';

// script: eslint --ext .js,.jsx,.tsx,.ts ./ --resolve-plugins-relative-to ./packages/spec
export default [
...eslint.getConfig({
preset: 'pkg',
}),
{
ignores: ['examples/**'],
},
];
3 changes: 3 additions & 0 deletions examples/common/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import eslint from '@ice/spec/eslint';

export default eslint.getConfig();
8 changes: 8 additions & 0 deletions examples/common/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "@ice/spec-example-common",
"version": "0.0.1",
"private": true,
"devDependencies": {
"@ice/spec": "workspace:*"
}
}
File renamed without changes.
4 changes: 4 additions & 0 deletions examples/react/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import eslint from '@ice/spec/eslint';

// script: eslint --ext .js,.jsx,.tsx,.ts ./ --resolve-plugins-relative-to ./packages/spec
export default eslint.getConfig();
12 changes: 12 additions & 0 deletions examples/react/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "@ice/spec-example-react",
"version": "0.0.1",
"private": true,
"scripts": {
"lint:code": "eslint .",
"lint:style": "stylelint src/**/*.{css,scss,less}"
},
"devDependencies": {
"@ice/spec": "workspace:*"
}
}
File renamed without changes.
1 change: 1 addition & 0 deletions examples/react/stylelint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from '@ice/spec/stylelint';
6 changes: 0 additions & 6 deletions lerna.json

This file was deleted.

49 changes: 25 additions & 24 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,34 +1,35 @@
{
"name": "iceworks-spec",
"name": "ice-spec-monorepo",
"private": true,
"devEngines": {
"node": "8.x || 9.x || 10.x || 11.x",
"npm": "6.x"
},
"type": "module",
"devDependencies": {
"@commitlint/cli": "^11.0.0",
"codecov": "^3.6.1",
"commitlint-config-ali": "^0.1.0",
"eslint": "^7.22.0",
"husky": "^7.0.1",
"@ice/pkg": "^1.6.0",
"@ice/spec": "workspace:*",
"eslint": "^9.0.0",
"husky": "^9.1.6",
"ice-npm-utils": "^2.0.1",
"jest": "^24.9.0",
"lerna": "^3.18.2",
"prettier": "^2.1.0",
"stylelint": "^13.2.0",
"typescript": "^3.5.3"
"lint-staged": "^15.2.10",
"prettier": "^3.0.0",
"stylelint": "^16.0.0",
"typescript": "^5.6.0",
"vitest": "^2.1.4"
},
"scripts": {
"prepare": "husky install",
"setup": "rm -rf ./packages/*/node_modules && lerna bootstrap --no-ci && lerna link",
"lint": "eslint --ext .js,.jsx,.tsx,.ts ./ --resolve-plugins-relative-to ./packages/spec",
"build": "pnpm run -r build",
"prepare": "husky",
"lint": "eslint ./",
"prettier": "prettier **/* --write",
"test": "jest && cd packages/spec && npm run test",
"publish": "node ./scripts/publish",
"ci": "npm run setup && npm run lint && npm run test"
"test": "vitest run"
},
"jest": {
"coverageDirectory": "./coverage/",
"collectCoverage": true
"packageManager": "[email protected]",
"lint-staged": {
"*.{js,jsx,ts,tsx}": [
"eslint --fix",
"prettier --write"
],
"*.{json,md,css,scss,less}": [
"prettier --write"
]
}
}
}
5 changes: 4 additions & 1 deletion packages/eslint-plugin-best-practices/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# changelog

## 0.2.11
- Remove `no-secret-info`.

- Remove `no-secret-info`.

## 0.2.10

- Update stylistic rules `dot-notation` and `@typescript-eslint/dot-notation` from error to off.

## 0.2.9
Expand Down
Loading
Loading