Skip to content

Commit

Permalink
Fixed some eslint issues when linting examples
Browse files Browse the repository at this point in the history
  • Loading branch information
matux committed Mar 2, 2024
1 parent 37dd862 commit 4f93287
Show file tree
Hide file tree
Showing 14 changed files with 154 additions and 78 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ build
bundles
coverage
dist
examples
lib
node_modules
out
Expand Down
68 changes: 68 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"env": {
"browser": true,
"es2022": true,
"jest": true,
"node": true
},
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"prettier",
"plugin:react-hooks/recommended",
"plugin:jest/recommended",
"plugin:jest-dom/recommended"
],
"parser": "@babel/eslint-parser",
"plugins": ["@babel", "jest", "react", "react-hooks", "testing-library"],
"settings": {
"react": {
"version": "detect"
}
},
"overrides": [
{
"files": ["**/*.mjs"],
"parserOptions": {
"babelOptions": {
"parserOpts": {
"plugins": ["importAssertions"]
}
}
}
},
{
"files": [
"**/__tests__/**/*.[jt]s?(x)",
"**/?(*.)+(spec|test).[jt]s?(x)"
],
"extends": ["plugin:testing-library/react"]
},
{
"files": ["**/*.ts?(x)"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"tsconfigRootDir": ".",
"project": ["./tsconfig.json"]
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking"
],
"rules": {
"@typescript-eslint/no-unused-vars": [
"error",
{
"varsIgnorePattern": "^_",
"argsIgnorePattern": "^_"
}
],
"@typescript-eslint/unbound-method": "off",
"jest/unbound-method": "error",
"react/react-in-jsx-scope": "off"
}
}
]
}
53 changes: 0 additions & 53 deletions .eslintrc.yaml

This file was deleted.

5 changes: 4 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ jobs:
prettier: true
eslint: true
eslint_args: '--max-warnings 0'
eslint_extensions: js,jsx,ts,tsx
eslint_extensions: js,jsx,mjs,cjs,ts,tsx

- name: Lint examples
run: npm run lint:examples

- name: Build
run: npm run build:all
Expand Down
3 changes: 3 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* @type {import('@babel/core').TransformOptions}
*/
module.exports = {
presets: ['@babel/preset-env', '@babel/preset-react'],
plugins: [
Expand Down
11 changes: 11 additions & 0 deletions examples/nextjs/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.github
.next
.yalc
build
bundles
coverage
dist
lib
node_modules
out
public
4 changes: 3 additions & 1 deletion examples/nextjs/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"root": true,
"extends": ["next/core-web-vitals"],
"ignorePatterns": ["node_modules", ".next"]
"rules": {
"react/react-in-jsx-scope": "off"
}
}
11 changes: 11 additions & 0 deletions examples/react-17/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.github
.next
.yalc
build
bundles
coverage
dist
lib
node_modules
out
public
4 changes: 4 additions & 0 deletions examples/react-17/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"root": true,
"extends": ["react-app", "react-app/jest"]
}
26 changes: 23 additions & 3 deletions examples/react-17/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 0 additions & 7 deletions examples/react-17/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,6 @@
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"root": true,
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
Expand Down
11 changes: 11 additions & 0 deletions examples/typescript/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.github
.next
.yalc
build
bundles
coverage
dist
lib
node_modules
out
public
24 changes: 12 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
],
"scripts": {
"test": "jest",
"lint": "eslint src babel.config.js index.d.ts",
"lint": "eslint . --ext .js,.jsx,.mjs,.cjs,.ts,.tsx",
"lint:examples": "ts-node scripts/foreach-example.ts npx eslint . --ext .js,.jsx,.mjs,.cjs,.ts,.tsx",
"lint:all": "npm run lint && npm run lint:examples",
"install:all": "node scripts/install-all.js",
"clean:build": "rimraf dist lib bundles",
"clean:all": "ts-node scripts/clean.ts",
Expand Down

0 comments on commit 4f93287

Please sign in to comment.