Skip to content

Commit

Permalink
feat: less lint rule (#107)
Browse files Browse the repository at this point in the history
  • Loading branch information
chenshuai2144 authored Sep 17, 2021
1 parent 33dd892 commit 4fc937c
Show file tree
Hide file tree
Showing 21 changed files with 26 additions and 87 deletions.
25 changes: 0 additions & 25 deletions jsExample/src/components/Authorized/AuthorizedRoute.jsx

This file was deleted.

2 changes: 1 addition & 1 deletion jsExample/src/components/Authorized/CheckPermissions.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { CURRENT } from './renderAuthorize'; // eslint-disable-next-line import/no-cycle
import { CURRENT } from './renderAuthorize'; // eslint-disable-next-line

import PromiseRender from './PromiseRender';

Expand Down
2 changes: 1 addition & 1 deletion jsExample/src/components/Authorized/PromiseRender.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { Spin } from 'antd';
import isEqual from 'lodash/isEqual';
import { isComponentClass } from './Secured'; // eslint-disable-next-line import/no-cycle
import { isComponentClass } from './Secured'; // eslint-disable-next-line

export default class PromiseRender extends React.Component {
state = {
Expand Down
3 changes: 0 additions & 3 deletions jsExample/src/components/Authorized/renderAuthorize.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
/* eslint-disable eslint-comments/disable-enable-pair */

/* eslint-disable import/no-mutable-exports */
let CURRENT = 'NULL';

/**
Expand Down
1 change: 0 additions & 1 deletion jsExample/src/service-worker.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable eslint-comments/disable-enable-pair */
/* eslint-disable no-restricted-globals */
/* eslint-disable no-underscore-dangle */
/* globals workbox */
Expand Down
3 changes: 0 additions & 3 deletions jsExample/src/utils/Authorized.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import RenderAuthorize from '@/components/Authorized';
import { getAuthority } from './authority';
/* eslint-disable eslint-comments/disable-enable-pair */

/* eslint-disable import/no-mutable-exports */

let Authorized = RenderAuthorize(getAuthority()); // Reload the rights component

Expand Down
2 changes: 1 addition & 1 deletion jsExample/src/utils/utils.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { parse } from 'querystring';
/* eslint no-useless-escape:0 import/prefer-default-export:0 */
/* eslint no-useless-escape:0 */

const reg =
/(((^https?:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+(?::\d+)?|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)$/;
Expand Down
2 changes: 0 additions & 2 deletions jsExample/tests/beforeTest.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable global-require */
/* eslint-disable import/no-extraneous-dependencies */
const { execSync } = require('child_process');
const { join } = require('path');
const findChrome = require('carlo/lib/find_chrome');
Expand All @@ -19,7 +18,6 @@ const installPuppeteer = () => {

const initPuppeteer = async () => {
try {
// eslint-disable-next-line import/no-unresolved
const findChromePath = await findChrome({});
const { executablePath } = findChromePath;
console.log(`🧲 find you browser in ${executablePath}`);
Expand Down
3 changes: 0 additions & 3 deletions jsExample/tests/getBrowser.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
/* eslint-disable global-require */
/* eslint-disable import/no-extraneous-dependencies */
const findChrome = require('carlo/lib/find_chrome');

const getBrowser = async () => {
try {
// eslint-disable-next-line import/no-unresolved
const puppeteer = require('puppeteer');
const browser = await puppeteer.launch({
args: [
Expand All @@ -21,7 +19,6 @@ const getBrowser = async () => {
}

try {
// eslint-disable-next-line import/no-unresolved
const puppeteer = require('puppeteer-core');
const findChromePath = await findChrome({});
const { executablePath } = findChromePath;
Expand Down
2 changes: 0 additions & 2 deletions jsExample/tests/run-tests.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
/* eslint-disable eslint-comments/disable-enable-pair */
/* eslint-disable @typescript-eslint/no-var-requires */
/* eslint-disable eslint-comments/no-unlimited-disable */
const { spawn } = require('child_process');
// eslint-disable-next-line import/no-extraneous-dependencies
const { kill } = require('cross-port-killer');

const env = Object.create(process.env);
Expand Down
18 changes: 5 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
"design",
"pro"
],
"bin": {
"fabric": "./cli.js"
},
"homepage": "https://github.com/umijs/fabric#readme",
"bugs": {
"url": "https://github.com/umijs/fabric/issues"
Expand All @@ -24,6 +21,9 @@
"license": "ISC",
"author": "[email protected]",
"main": "dist/index.js",
"bin": {
"fabric": "./cli.js"
},
"files": [
"dist",
"cli.js"
Expand All @@ -36,9 +36,9 @@
"lint-js": "npm run build && cd jsExample && npm run lint",
"prepublishOnly": "npm run build && npm test && np --no-cleanup --yolo --no-publish --any-branch",
"prettier": "prettier -c --write \"**/*\"",
"testTS": "npm run build && cd tsExample && npm run lint",
"test": "npm run testTS && npm run testJS",
"testJS": "npm run build && cd jsExample && npm run lint",
"test": "npm run testTS && npm run testJS"
"testTS": "npm run build && cd tsExample && npm run lint"
},
"dependencies": {
"@babel/core": "^7.12.10",
Expand All @@ -52,16 +52,10 @@
"@typescript-eslint/parser": "^4.10.0",
"chalk": "^4.1.1",
"eslint": "^7.11.0",
"eslint-config-airbnb-base": "^14.2.0",
"eslint-config-prettier": "^8.3.0",
"eslint-formatter-pretty": "^4.0.0",
"eslint-plugin-babel": "^5.3.0",
"eslint-plugin-compat": "^3.1.1",
"eslint-plugin-eslint-comments": "^3.1.1",
"eslint-plugin-import": "^2.17.3",
"eslint-plugin-jest": "^24.0.1",
"eslint-plugin-jsx-a11y": "^6.2.0",
"eslint-plugin-markdown": "^2.2.0",
"eslint-plugin-promise": "^5.0.0",
"eslint-plugin-react": "^7.21.5",
"eslint-plugin-react-hooks": "^4.1.2",
Expand All @@ -73,10 +67,8 @@
"stylelint": "^13.7.0",
"stylelint-config-css-modules": "^2.2.0",
"stylelint-config-prettier": "^8.0.1",
"stylelint-config-rational-order": "^0.1.2",
"stylelint-config-standard": "^20.0.0",
"stylelint-declaration-block-no-ignored-properties": "^2.1.0",
"stylelint-no-unsupported-browser-features": "^4.1.4",
"typescript": "^4.3.5"
},
"devDependencies": {
Expand Down
23 changes: 3 additions & 20 deletions src/eslint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ if (isTsProject) {
}

module.exports = {
extends: ['eslint-config-airbnb-base', 'prettier'].concat(
extends: ['prettier'].concat(
isTsProject ? ['plugin:@typescript-eslint/recommended'] : ['plugin:react/recommended'],
),
parser: isTsProject ? '@typescript-eslint/parser' : '@babel/eslint-parser',
plugins: ['eslint-comments', 'react', 'jest', 'unicorn', 'react-hooks'],
plugins: ['react', 'jest', 'unicorn', 'react-hooks'],
env: {
browser: true,
node: true,
Expand All @@ -52,6 +52,7 @@ module.exports = {
jasmine: true,
},
rules: {
strict: ['error', 'never'],
'react/display-name': 0,
'react/jsx-props-no-spreading': 0,
'react/state-in-constructor': 0,
Expand All @@ -72,23 +73,6 @@ module.exports = {
'react/jsx-one-expression-per-line': 0,
'generator-star-spacing': 0,
'function-paren-newline': 0,
'import/no-unresolved': 0,
'import/order': 0,
'import/no-named-as-default': 0,
'import/no-cycle': 0,
'import/prefer-default-export': 0,
'import/no-default-export': 0,
'import/no-extraneous-dependencies': 0,
'import/named': 0,
'import/no-named-as-default-member': 0,
'import/no-duplicates': 0,
'import/no-self-import': 0,
'import/extensions': 0,
'import/no-useless-path-segments': 0,
'jsx-a11y/no-noninteractive-element-interactions': 0,
'jsx-a11y/click-events-have-key-events': 0,
'jsx-a11y/no-static-element-interactions': 0,
'jsx-a11y/anchor-is-valid': 0,
'sort-imports': 0,
'class-methods-use-this': 0,
'no-confusing-arrow': 0,
Expand All @@ -102,7 +86,6 @@ module.exports = {
'object-curly-newline': 0,
'implicit-arrow-linebreak': 0,
'operator-linebreak': 0,
'eslint-comments/no-unlimited-disable': 0,
'no-param-reassign': 2,
'space-before-function-paren': 0,
'react/self-closing-comp': 1,
Expand Down
4 changes: 2 additions & 2 deletions src/stylelint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@ module.exports = {
extends: [
'stylelint-config-standard',
'stylelint-config-css-modules',
'stylelint-config-rational-order',
'stylelint-config-prettier',
'stylelint-no-unsupported-browser-features',
],
plugins: ['stylelint-declaration-block-no-ignored-properties'],
rules: {
'no-descending-specificity': null,
//https://github.com/stylelint/stylelint/issues/4114
'function-calc-no-invalid': null,
'function-url-quotes': 'always',
'selector-attribute-quotes': 'always',
'font-family-no-missing-generic-family-keyword': null, // iconfont
'plugin/declaration-block-no-ignored-properties': true,
'unit-no-unknown': [true, { ignoreUnits: ['rpx'] }],
// webcomponent
'selector-type-no-unknown': null,
'value-keyword-case': ['lower', { ignoreProperties: ['composes'] }],
},
ignoreFiles: ['**/*.js', '**/*.jsx', '**/*.tsx', '**/*.ts'],
};
3 changes: 1 addition & 2 deletions src/verifyCommit.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable import/no-extraneous-dependencies */
// Invoked on the commit-msg git hook by yorkie.
// Invoked on the commit-msg git hook by yorkie.

const chalk = require('chalk');
const osLocale = require('os-locale');
Expand Down
2 changes: 1 addition & 1 deletion tsExample/src/components/Authorized/CheckPermissions.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { CURRENT } from './renderAuthorize';
// eslint-disable-next-line import/no-cycle
// eslint-disable-next-line
import PromiseRender from './PromiseRender';

export type IAuthorityType =
Expand Down
2 changes: 1 addition & 1 deletion tsExample/src/components/Authorized/PromiseRender.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import { Spin } from 'antd';
import isEqual from 'lodash/isEqual';
import { isComponentClass } from './Secured';
// eslint-disable-next-line import/no-cycle
// eslint-disable-next-line

type PromiseRenderProps<T, K> = {
ok: T;
Expand Down
2 changes: 0 additions & 2 deletions tsExample/src/components/Authorized/renderAuthorize.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-disable eslint-comments/disable-enable-pair */
/* eslint-disable import/no-mutable-exports */
let CURRENT: string | string[] = 'NULL';

type CurrentAuthorityType = string | string[] | (() => typeof CURRENT);
Expand Down
8 changes: 8 additions & 0 deletions tsExample/src/global.less
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,11 @@ ol {
min-height: 100vh;
}
}

.panelTitleItem {
display: flex;
}

.info {
composes: panelTitleItem;
}
1 change: 0 additions & 1 deletion tsExample/src/service-worker.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable eslint-comments/disable-enable-pair */
/* eslint-disable no-restricted-globals */
/* eslint-disable no-underscore-dangle */
/* globals workbox */
Expand Down
3 changes: 1 addition & 2 deletions tsExample/src/utils/Authorized.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import RenderAuthorize from '@/components/Authorized';
import { getAuthority } from './authority';
/* eslint-disable eslint-comments/disable-enable-pair */
/* eslint-disable import/no-mutable-exports */

let Authorized = RenderAuthorize(getAuthority());

// Reload the rights component
Expand Down
2 changes: 1 addition & 1 deletion tsExample/src/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { parse } from 'querystring';
import pathRegexp from 'path-to-regexp';
import type { Route } from '@/models/connect';

/* eslint no-useless-escape:0 import/prefer-default-export:0 */
/* eslint no-useless-escape:0 */
const reg =
/(((^https?:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+(?::\d+)?|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)$/;

Expand Down

0 comments on commit 4fc937c

Please sign in to comment.