Skip to content
This repository was archived by the owner on Jun 28, 2022. It is now read-only.

Commit

Permalink
fix: update eslint rules
Browse files Browse the repository at this point in the history
  • Loading branch information
arantespp committed Oct 5, 2020
1 parent 85e0d35 commit 5699593
Show file tree
Hide file tree
Showing 13 changed files with 939 additions and 770 deletions.
4 changes: 3 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
module.exports = require('./config/eslintrc.base');
module.exports = {
extends: './config/eslintrc.base',
};
30 changes: 24 additions & 6 deletions config/eslintrc.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,33 @@ module.exports = {
'prettier/@typescript-eslint',
],
rules: {
'@typescript-eslint/explicit-module-boundary-types': 'off', // annoying to force return type,
'@typescript-eslint/explicit-function-return-type': 'off', // annoying to force return type,
/**
* Annoying to force return type.
*/
'@typescript-eslint/explicit-module-boundary-types': 'off',
/**
* annoying to force return type.
*/
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unused-vars': 'error',
'@typescript-eslint/prefer-optional-chain': 'error',
'import/extensions': 'off', // TODO: remove some day. ES modules don't import without extensions
'import/no-unresolved': 'off', // Remove error when importing Yarn Workspace modules.
'import/no-extraneous-dependencies': 'off', // Remove error when importing Yarn Workspace modules.
'import/prefer-default-export': 'off', // Allow single Named-export
/**
* TODO: remove some day. ES modules don't import without extensions
*/
'import/extensions': 'off',
/**
* Remove error when importing Yarn Workspace modules.
*/
'import/no-unresolved': 'off',
/**
* Remove error when importing Yarn Workspace modules.
*/
'import/no-extraneous-dependencies': 'off',
/**
* Allow single Named-export.
*/
'import/prefer-default-export': 'off',
'no-console': 'off',
},
overrides: [
Expand Down
24 changes: 18 additions & 6 deletions config/eslintrc.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,29 @@ module.exports = {
extends: ['airbnb', 'react-app', path.resolve(__dirname, 'eslintrc.base.js')],
rules: {
'no-console': 'error',
'react/jsx-props-no-spreading': 'off',
/**
* Also want to use with ".tsx".
*/
'react/jsx-filename-extension': [
'warn',
{
extensions: ['.jsx', '.tsx'],
},
], // also want to use with ".tsx".
'react/jsx-wrap-multilines': 'off', // This rule conflicts with prettier/prettier.
'react/prop-types': 'off', // Is this incompatible with TS props type?
'react/react-in-jsx-scope': 'off', // Do not required by TypeScript 4.
'react/require-default-props': 'off', // Problems with function components.
],
'react/jsx-props-no-spreading': 'off',
/**
* This rule conflicts with prettier/prettier.
*/
'react/jsx-wrap-multilines': 'off',
/**
* Is this incompatible with TS props type?
*/
'react/prop-types': 'off',
'react/react-in-jsx-scope': 'off',
/**
* Problems with function components.
*/
'react/require-default-props': 'off',
'react-hooks/rules-of-hooks': 'error',
'relay/graphql-syntax': 'error',
'relay/compat-uses-vars': 'warn',
Expand Down
2 changes: 1 addition & 1 deletion config/tsconfig.base.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"compilerOptions": {
/* Basic Options */
"incremental": false /* Enable incremental compilation */,
// "incremental": true /* Enable incremental compilation */,
"target": "es2018" /* es2018 requires NodeJS >= 10. Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */,
"module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */,
// "lib": [], /* Specify library files to be included in the compilation. */
Expand Down
3 changes: 1 addition & 2 deletions config/tsconfig.react.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"compilerOptions": {
"target": "esnext",
"lib": ["dom", "dom.iterable", "esnext"],
"jsx": "react",
"incremental": false
"jsx": "react"
}
}
3 changes: 3 additions & 0 deletions lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
"allowBranch": "master",
"conventionalCommits": true,
"message": "chore: publish new version"
},
"version": {
"forcePublish": true
}
},
"npmClient": "yarn",
Expand Down
46 changes: 25 additions & 21 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
"update-all": "npx ncu -u && lerna exec -- npx ncu -u",
"reinstall": "yarn run remove-all-node-modules && yarn",
"remove-all-node-modules": "npx lerna exec -- rm -rf node_modules && rm -rf node_modules && rm -f yarn.lock",
"publish": "lerna publish && lerna run deploy --scope carlin-website"
"publish": "lerna publish && lerna run deploy --scope carlin-website",
"version": "lerna version",
"test": "lerna run test",
"build": "lerna run build",
"deploy": "lerna run deploy"
},
"repository": {
"type": "git",
Expand All @@ -23,39 +27,39 @@
},
"license": "MIT",
"devDependencies": {
"@commitlint/cli": "^9.1.2",
"@commitlint/config-conventional": "^9.1.2",
"@typescript-eslint/eslint-plugin": "^3.9.1",
"@typescript-eslint/parser": "^3.9.1",
"eslint": "^7.7.0",
"@commitlint/cli": "^11.0.0",
"@commitlint/config-conventional": "^11.0.0",
"@typescript-eslint/eslint-plugin": "^4.3.0",
"@typescript-eslint/parser": "^4.3.0",
"eslint": "^7.10.0",
"eslint-config-airbnb": "^18.2.0",
"eslint-config-airbnb-base": "^14.2.0",
"eslint-config-prettier": "^6.11.0",
"eslint-config-prettier": "^6.12.0",
"eslint-config-react-app": "^5.2.1",
"eslint-plugin-flowtype": "^5.2.0",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-jest": "^23.20.0",
"eslint-plugin-jest-dom": "^3.1.7",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jest": "^24.0.2",
"eslint-plugin-jest-dom": "^3.2.3",
"eslint-plugin-jsx-a11y": "^6.3.1",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-react": "^7.20.6",
"eslint-plugin-react-hooks": "^4.1.0",
"eslint-plugin-react": "^7.21.3",
"eslint-plugin-react-hooks": "^4.1.2",
"eslint-plugin-relay": "^1.8.1",
"faker": "^4.1.0",
"husky": "^4.2.5",
"husky": "^4.3.0",
"imagemin-lint-staged": "^0.4.0",
"jest": "^26.4.1",
"jest": "^26.5.0",
"jest-emotion": "^10.0.32",
"lerna": "^3.22.1",
"lint-staged": "^10.2.11",
"npm-check-updates": "^7.1.1",
"prettier": "^2.0.5",
"stylelint": "^13.6.1",
"lint-staged": "^10.4.0",
"npm-check-updates": "^9.0.3",
"prettier": "^2.1.2",
"stylelint": "^13.7.2",
"stylelint-config-prettier": "^8.0.2",
"stylelint-prettier": "^1.1.2",
"ts-jest": "^26.2.0",
"ts-node": "^8.10.2",
"typescript": "^4.0.2"
"ts-jest": "^26.4.1",
"ts-node": "^9.0.0",
"typescript": "^4.0.3"
},
"workspaces": [
"packages/**/*"
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/monorepo/templates/dot-eslintignore.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const templateName = '.eslintigignore';
export const templateName = '.eslintignore';

export const dir = '.';

Expand Down
4 changes: 3 additions & 1 deletion packages/cli/src/monorepo/templates/dot-eslintrc.js.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@ export const templateName = '.eslintrc.js';
export const dir = '.';

export const content = `
module.exports = require('./config/eslintrc.base');
module.exports = {
extends: './config/eslintrc.base',
};
`;
30 changes: 24 additions & 6 deletions packages/cli/src/monorepo/templates/eslintrc.base.js.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,33 @@ module.exports = {
'prettier/@typescript-eslint',
],
rules: {
'@typescript-eslint/explicit-module-boundary-types': 'off', // annoying to force return type,
'@typescript-eslint/explicit-function-return-type': 'off', // annoying to force return type,
/**
* Annoying to force return type.
*/
'@typescript-eslint/explicit-module-boundary-types': 'off',
/**
* annoying to force return type.
*/
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unused-vars': 'error',
'@typescript-eslint/prefer-optional-chain': 'error',
'import/extensions': 'off', // TODO: remove some day. ES modules don't import without extensions
'import/no-unresolved': 'off', // Remove error when importing Yarn Workspace modules.
'import/no-extraneous-dependencies': 'off', // Remove error when importing Yarn Workspace modules.
'import/prefer-default-export': 'off', // Allow single Named-export
/**
* TODO: remove some day. ES modules don't import without extensions
*/
'import/extensions': 'off',
/**
* Remove error when importing Yarn Workspace modules.
*/
'import/no-unresolved': 'off',
/**
* Remove error when importing Yarn Workspace modules.
*/
'import/no-extraneous-dependencies': 'off',
/**
* Allow single Named-export.
*/
'import/prefer-default-export': 'off',
'no-console': 'off',
},
overrides: [
Expand Down
23 changes: 18 additions & 5 deletions packages/cli/src/monorepo/templates/eslintrc.react.js.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,29 @@ module.exports = {
extends: ['airbnb', 'react-app', path.resolve(__dirname, 'eslintrc.base.js')],
rules: {
'no-console': 'error',
'react/jsx-props-no-spreading': 'off',
/**
* Also want to use with ".tsx".
*/
'react/jsx-filename-extension': [
'warn',
{
extensions: ['.jsx', '.tsx'],
},
], // also want to use with ".tsx"
'react/prop-types': 'off', // Is this incompatible with TS props type?
'react/jsx-wrap-multilines': 'off', // This rule conflicts with prettier/prettier
'react/require-default-props': 'off', // Problems with function components
],
'react/jsx-props-no-spreading': 'off',
/**
* This rule conflicts with prettier/prettier.
*/
'react/jsx-wrap-multilines': 'off',
/**
* Is this incompatible with TS props type?
*/
'react/prop-types': 'off',
'react/react-in-jsx-scope': 'off',
/**
* Problems with function components.
*/
'react/require-default-props': 'off',
'react-hooks/rules-of-hooks': 'error',
'relay/graphql-syntax': 'error',
'relay/compat-uses-vars': 'warn',
Expand Down
5 changes: 1 addition & 4 deletions packages/website/components/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Footer from './Footer';
import Header from './Header';
import MaxWidth from './MaxWidth';

const padding = [4];
const padding = [3];

const navs: Array<{
group: string;
Expand Down Expand Up @@ -56,9 +56,6 @@ const Aside = () => {
alignContent: 'center',
minWidth: ['fit-content'],
width: ['fit-content'],
borderRightColor: 'gray',
borderRightStyle: [0],
borderRightWidth: 0,
}}
>
{navs.map(({ group, links }) => {
Expand Down
Loading

0 comments on commit 5699593

Please sign in to comment.