Skip to content

Commit

Permalink
chore: update eslint config
Browse files Browse the repository at this point in the history
  • Loading branch information
Lmmmmmm-bb committed May 2, 2023
1 parent 27be8a7 commit 8f74755
Show file tree
Hide file tree
Showing 21 changed files with 2,014 additions and 988 deletions.
7 changes: 1 addition & 6 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
node_modules
dist

pnpm-lock.yaml

LICENSE
README.md
33 changes: 1 addition & 32 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,34 +1,3 @@
{
"env": {
"browser": true,
"es2021": true,
"node": true
},
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": "latest",
"sourceType": "module"
},
"settings": {
"react": {
"version": "detect"
}
},
"plugins": ["react", "@typescript-eslint"],
"rules": {
"react/react-in-jsx-scope": "off",
"no-console": "warn",
"react/self-closing-comp": "error",
"arrow-body-style": "error",
"prefer-template": "error"
}
"extends": ["@lmmmmmm", "@lmmmmmm/eslint-config-react"]
}
4 changes: 2 additions & 2 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: 'CodeQL'
name: CodeQL

on:
push:
Expand All @@ -20,7 +20,7 @@ jobs:
strategy:
fail-fast: false
matrix:
language: ['javascript', 'typescript']
language: [javascript, typescript]

steps:
- name: Checkout repository
Expand Down
5 changes: 0 additions & 5 deletions .prettierignore

This file was deleted.

12 changes: 0 additions & 12 deletions .prettierrc

This file was deleted.

8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ pnpm i semi-context-menu
```tsx
export default () => {
const renderItem = (left: string, right: string) => (
<div className='item'>
<div className='left'>{left}</div>
<div className='right'>{right}</div>
<div className="item">
<div className="left">{left}</div>
<div className="right">{right}</div>
</div>
);

Expand All @@ -50,7 +50,7 @@ export default () => {
);

return (
<div className='App'>
<div className="App">
<SemiContextMenu clickToHide render={menu}>
<div>This is Context Menu Operable Area</div>
</SemiContextMenu>
Expand Down
2 changes: 1 addition & 1 deletion commitlint.config.cjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
extends: ['@commitlint/config-conventional']
extends: ['@commitlint/config-conventional'],
};
52 changes: 23 additions & 29 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,14 @@
{
"name": "semi-context-menu",
"version": "0.2.0",
"license": "MIT",
"type": "module",
"version": "0.2.0",
"packageManager": "[email protected]",
"description": "Context Menu based on Semi Design.",
"keywords": [
"semi-design",
"context-menu",
"react-context-menu",
"react",
"react-component",
"react-component-library"
],
"author": {
"email": "[email protected]",
"name": "_lmmmmmm"
},
"license": "MIT",
"homepage": "https://github.com/Lmmmmmm-bb/semi-context-menu",
"repository": {
"type": "git",
Expand All @@ -26,50 +18,53 @@
"url": "https://github.com/Lmmmmmm-bb/semi-context-menu/issues",
"email": "[email protected]"
},
"files": [
"dist"
"keywords": [
"semi-design",
"context-menu",
"react-context-menu",
"react",
"react-component",
"react-component-library"
],
"types": "dist/index.d.ts",
"module": "dist/index.js",
"main": "dist/index.cjs",
"exports": {
".": {
"import": "./dist/index.js",
"require": "./dist/index.cjs"
"require": "./dist/index.cjs",
"import": "./dist/index.js"
}
},
"main": "dist/index.cjs",
"module": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
"dist"
],
"scripts": {
"dev": "pnpm style:watch & tsup --watch",
"playground": "vite playground --host & pnpm style:watch",
"build": "tsup",
"build:playground": "vite build playground",
"lint:check": "prettier --check .",
"lint:format": "prettier --write .",
"lint:fix": "eslint --ext .tsx,.ts,.js . --fix",
"lint": "eslint . --fix",
"prepare": "husky install",
"style:watch": "typed-scss-modules src --watch --ignore \"**/index.scss\"",
"release": "bumpp --commit --tag --push && pnpm publish --no-git-checks"
},
"peerDependencies": {
"@douyinfe/semi-ui": ">=2",
"react": ">=18",
"react-dom": ">=18",
"@douyinfe/semi-ui": ">=2"
"react-dom": ">=18"
},
"devDependencies": {
"@commitlint/cli": "^17.4.4",
"@commitlint/config-conventional": "^17.4.4",
"@douyinfe/semi-ui": "^2.30.2",
"@lmmmmmm/eslint-config": "^0.1.0",
"@lmmmmmm/eslint-config-react": "^0.1.0",
"@types/node": "^18.15.3",
"@types/react": "^18.0.28",
"@types/react-dom": "^18.0.11",
"@typescript-eslint/eslint-plugin": "^5.55.0",
"@typescript-eslint/parser": "^5.55.0",
"bumpp": "^9.0.0",
"esbuild-scss-modules-plugin": "^1.1.1",
"eslint": "^8.36.0",
"eslint-config-prettier": "^8.7.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react": "^7.32.2",
"husky": "^8.0.3",
"lint-staged": "^13.2.0",
"prettier": "^2.8.4",
Expand All @@ -82,7 +77,6 @@
"vite": "^4.1.4"
},
"lint-staged": {
"**/*": "prettier --write . --ignore-unknown",
"*.{js,ts,tsx}": "eslint --ext .tsx,.ts,.js . --fix"
"*.{js,ts,tsx}": "eslint . --fix"
}
}
2 changes: 1 addition & 1 deletion playground/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "playground",
"private": true,
"type": "module",
"private": true,
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
Expand Down
4 changes: 2 additions & 2 deletions playground/src/app/config.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export const examplesSource =
'https://github.com/Lmmmmmm-bb/semi-context-menu/tree/main/playground/src/examples';
export const examplesSource
= 'https://github.com/Lmmmmmm-bb/semi-context-menu/tree/main/playground/src/examples';
4 changes: 2 additions & 2 deletions playground/src/app/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FC } from 'react';
import { type FC } from 'react';
import { Typography } from '@douyinfe/semi-ui';

import './index.css';
Expand All @@ -8,7 +8,7 @@ import { Base, WithProps } from '../examples';
const { Text } = Typography;

const App: FC = () => (
<div className='App'>
<div className="App">
<header>
<Text link={{ href: examplesSource, target: '_blank' }}>
<h2>Example Code</h2>
Expand Down
6 changes: 3 additions & 3 deletions playground/src/components/block/index.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { CSSProperties, FC, PropsWithChildren } from 'react';
import { type CSSProperties, type FC, type PropsWithChildren } from 'react';

import './index.css';

interface BlockProps {
color: CSSProperties['backgroundColor'];
}

const Block: FC<PropsWithChildren<BlockProps>> = (props) => (
<div className='block' style={{ backgroundColor: props.color }}>
const Block: FC<PropsWithChildren<BlockProps>> = props => (
<div className="block" style={{ backgroundColor: props.color }}>
{props.children}
</div>
);
Expand Down
4 changes: 2 additions & 2 deletions playground/src/examples/Base.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FC } from 'react';
import { type FC } from 'react';
import { Dropdown, Toast } from '@douyinfe/semi-ui';
import { SemiContextMenu } from 'semi-context-menu';
import { IconCopy, IconRefresh } from '@douyinfe/semi-icons';
Expand All @@ -25,7 +25,7 @@ const Base: FC = () => {

return (
<SemiContextMenu clickToHide render={menu}>
<Block color='orange'>Base Usage</Block>
<Block color="orange">Base Usage</Block>
</SemiContextMenu>
);
};
Expand Down
8 changes: 4 additions & 4 deletions playground/src/examples/WithProps.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FC } from 'react';
import { type FC } from 'react';
import { Dropdown, Toast } from '@douyinfe/semi-ui';
import { SemiContextMenu } from 'semi-context-menu';
import { IconCopy, IconDelete } from '@douyinfe/semi-icons';
Expand All @@ -12,14 +12,14 @@ const WithProps: FC = () => {
<Dropdown.Title>With Semi Dropdown Props</Dropdown.Title>
<Dropdown.Divider />
<Dropdown.Item
type='primary'
type="primary"
icon={<IconCopy />}
onClick={() => Toast.success('Paste')}
>
{renderItem('Paste', 'Ctrl + V')}
</Dropdown.Item>
<Dropdown.Item
type='danger'
type="danger"
icon={<IconDelete />}
onClick={() => Toast.success('Delete')}
>
Expand All @@ -30,7 +30,7 @@ const WithProps: FC = () => {

return (
<SemiContextMenu clickToHide render={menu}>
<Block color='olive'>With Semi Dropdown Props</Block>
<Block color="olive">With Semi Dropdown Props</Block>
</SemiContextMenu>
);
};
Expand Down
6 changes: 3 additions & 3 deletions playground/src/examples/utils.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const renderItem = (left: string, right: string) => (
<div className='item'>
<div className='left'>{left}</div>
<div className='right'>{right}</div>
<div className="item">
<div className="left">{left}</div>
<div className="right">{right}</div>
</div>
);
2 changes: 1 addition & 1 deletion playground/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ import App from './app';
ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
<React.StrictMode>
<App />
</React.StrictMode>
</React.StrictMode>,
);
2 changes: 1 addition & 1 deletion playground/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ import react from '@vitejs/plugin-react';

// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()]
plugins: [react()],
});
Loading

0 comments on commit 8f74755

Please sign in to comment.