Skip to content
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

Fix eslint config #5720

Merged
merged 6 commits into from
May 8, 2024
Merged
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
5 changes: 0 additions & 5 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
.eslintrc.js
scripts/*.js
docs/*
plugin/*
eslintrc.js
jest.config.js
eslintPlugin/*
mock.js
77 changes: 43 additions & 34 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,49 @@
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
parserOptions: {
project: true,
tsconfigRootDir: __dirname,
},
overrides: [
{
files: ['*.ts', '*.tsx'],
parser: '@typescript-eslint/parser',
parserOptions: {
project: true,
tsconfigRootDir: __dirname,
},
extends: ['plugin:@typescript-eslint/recommended-type-checked'],
rules: {
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/ban-ts-comment': [
'error',
{
'ts-ignore': 'allow-with-description',
'ts-expect-error': 'allow-with-description',
},
],
'@typescript-eslint/no-unused-vars': [
'error',
{ argsIgnorePattern: '^_' },
],
'@typescript-eslint/no-var-requires': 'warn',
'@typescript-eslint/consistent-type-imports': [
'error',
{ prefer: 'type-imports' },
],
'@typescript-eslint/consistent-type-exports': [
'error',
{ fixMixedExportsWithInlineTypeSpecifier: false },
],
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-duplicate-type-constituents': 'error',
'@typescript-eslint/no-shadow': 'error',
},
},
],
extends: [
'standard',
'plugin:@typescript-eslint/recommended-type-checked',
'prettier',
'plugin:import/typescript',
'plugin:react-hooks/recommended',
Expand All @@ -32,43 +68,16 @@ module.exports = {
},
},
rules: {
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-explicit-any': 'warn',
'object-shorthand': 'error',
curly: 'error',
curly: ['error', 'all'],
'no-case-declarations': 'error',
'@typescript-eslint/no-shadow': 'error',
'import/no-unresolved': 'error',
'import/consistent-type-specifier-style': ['error', 'prefer-top-level'],
'react/jsx-uses-vars': 'error',
'react/jsx-uses-react': 'error',
'no-use-before-define': 'off',
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/ban-ts-comment': [
'error',
{
'ts-ignore': 'allow-with-description',
'ts-expect-error': 'allow-with-description',
},
],
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
'@typescript-eslint/no-var-requires': 'warn',
// '@typescript-eslint/no-duplicate-type-constituents': 'error', // TODO this currently breaks ESLint for VSCode in plugin
eqeqeq: 'error',
'no-unreachable': 'error',
'@typescript-eslint/consistent-type-imports': [
'error',
{ prefer: 'type-imports' },
],
'@typescript-eslint/consistent-type-exports': [
'error',
{ fixMixedExportsWithInlineTypeSpecifier: false },
],
'tsdoc/syntax': 'error',
'@typescript-eslint/no-non-null-assertion': 'off',
},
};
2 changes: 1 addition & 1 deletion Example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"@types/react": "^18.2.6",
"@types/react-test-renderer": "^18.0.0",
"babel-jest": "^29.6.3",
"eslint": "^8.19.0",
"eslint": "^8.0.0-0",
"jest": "^29.6.3",
"patch-package": "^8.0.0",
"prettier": "2.8.8",
Expand Down
4 changes: 2 additions & 2 deletions Example/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3161,7 +3161,7 @@ __metadata:
"@types/react": "npm:^18.2.6"
"@types/react-test-renderer": "npm:^18.0.0"
babel-jest: "npm:^29.6.3"
eslint: "npm:^8.19.0"
eslint: "npm:^8.0.0-0"
jest: "npm:^29.6.3"
patch-package: "npm:^8.0.0"
prettier: "npm:2.8.8"
Expand Down Expand Up @@ -4874,7 +4874,7 @@ __metadata:
languageName: node
linkType: hard

"eslint@npm:^8.19.0":
"eslint@npm:^8.0.0-0":
version: 8.57.0
resolution: "eslint@npm:8.57.0"
dependencies:
Expand Down
2 changes: 1 addition & 1 deletion FabricExample/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"@types/react": "^18.2.6",
"@types/react-test-renderer": "^18.0.0",
"babel-jest": "^29.6.3",
"eslint": "^8.19.0",
"eslint": "^8.0.0-0",
"jest": "^29.6.3",
"prettier": "2.8.8",
"react-test-renderer": "18.2.0",
Expand Down
4 changes: 2 additions & 2 deletions FabricExample/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3143,7 +3143,7 @@ __metadata:
"@types/react": "npm:^18.2.6"
"@types/react-test-renderer": "npm:^18.0.0"
babel-jest: "npm:^29.6.3"
eslint: "npm:^8.19.0"
eslint: "npm:^8.0.0-0"
jest: "npm:^29.6.3"
prettier: "npm:2.8.8"
react: "npm:18.2.0"
Expand Down Expand Up @@ -4848,7 +4848,7 @@ __metadata:
languageName: node
linkType: hard

"eslint@npm:^8.19.0":
"eslint@npm:^8.0.0-0":
version: 8.57.0
resolution: "eslint@npm:8.57.0"
dependencies:
Expand Down
2 changes: 1 addition & 1 deletion MacOSExample/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"@types/react": "^18.2.6",
"@types/react-test-renderer": "^18.0.0",
"babel-jest": "^29.6.3",
"eslint": "^8.19.0",
"eslint": "^8.0.0-0",
"jest": "^29.6.3",
"prettier": "2.8.8",
"react-test-renderer": "18.2.0",
Expand Down
4 changes: 2 additions & 2 deletions MacOSExample/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3268,7 +3268,7 @@ __metadata:
"@types/react": "npm:^18.2.6"
"@types/react-test-renderer": "npm:^18.0.0"
babel-jest: "npm:^29.6.3"
eslint: "npm:^8.19.0"
eslint: "npm:^8.0.0-0"
jest: "npm:^29.6.3"
prettier: "npm:2.8.8"
react: "npm:18.2.0"
Expand Down Expand Up @@ -5019,7 +5019,7 @@ __metadata:
languageName: node
linkType: hard

"eslint@npm:^8.19.0":
"eslint@npm:^8.0.0-0":
version: 8.57.0
resolution: "eslint@npm:8.57.0"
dependencies:
Expand Down
2 changes: 1 addition & 1 deletion TVOSExample/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"@types/react": "^18.2.6",
"@types/react-test-renderer": "^18.0.0",
"babel-jest": "^29.6.3",
"eslint": "^8.19.0",
"eslint": "^8.0.0-0",
"jest": "^29.6.3",
"prettier": "2.8.8",
"react-test-renderer": "18.2.0",
Expand Down
4 changes: 2 additions & 2 deletions TVOSExample/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3493,7 +3493,7 @@ __metadata:
"@types/react": "npm:^18.2.6"
"@types/react-test-renderer": "npm:^18.0.0"
babel-jest: "npm:^29.6.3"
eslint: "npm:^8.19.0"
eslint: "npm:^8.0.0-0"
expo: "npm:^50.0.2"
jest: "npm:^29.6.3"
prettier: "npm:2.8.8"
Expand Down Expand Up @@ -5545,7 +5545,7 @@ __metadata:
languageName: node
linkType: hard

"eslint@npm:^8.19.0":
"eslint@npm:^8.0.0-0":
version: 8.57.0
resolution: "eslint@npm:8.57.0"
dependencies:
Expand Down
2 changes: 1 addition & 1 deletion WebExample/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"@react-native/metro-config": "0.74.81",
"@react-native/typescript-config": "0.74.81",
"@types/react": "~18.0.14",
"eslint": "^8.19.0",
"eslint": "^8.0.0-0",
"prettier": "^2.4.1",
"typescript": "5.0.4"
},
Expand Down
4 changes: 2 additions & 2 deletions WebExample/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6178,7 +6178,7 @@ __metadata:
languageName: node
linkType: hard

"eslint@npm:^8.19.0":
"eslint@npm:^8.0.0-0":
version: 8.57.0
resolution: "eslint@npm:8.57.0"
dependencies:
Expand Down Expand Up @@ -13267,7 +13267,7 @@ __metadata:
"@react-native/metro-config": "npm:0.74.81"
"@react-native/typescript-config": "npm:0.74.81"
"@types/react": "npm:~18.0.14"
eslint: "npm:^8.19.0"
eslint: "npm:^8.0.0-0"
expo: "npm:~48.0.10"
expo-status-bar: "npm:~1.4.0"
prettier: "npm:^2.4.1"
Expand Down
2 changes: 1 addition & 1 deletion __tests__/plugin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { TransformOptions, transformSync } from '@babel/core';
import traverse from '@babel/traverse';
import { strict as assert } from 'assert';
import '../plugin/jestUtils';
import '../plugin/src/jestMatchers';
import { version as packageVersion } from '../package.json';
import { ReanimatedPluginOptions } from '../plugin/src/types';

Expand Down Expand Up @@ -93,7 +93,7 @@
expect(code).toContain('sourceMap: "{');
// this non-mocked source map is hard-coded, feel free to update it accordingly
expect(code).toContain(
'\\"mappings\\":\\"AACQ,SAAAA,GAASA,CAAA,CAAG,CAEV,GAAI,CAAAA,GAAG,CAAG,KAAK,CACjB\\"'

Check warning on line 96 in __tests__/plugin.test.ts

View workflow job for this annotation

GitHub Actions / spellcheck

Unknown word (AACQ)

Check warning on line 96 in __tests__/plugin.test.ts

View workflow job for this annotation

GitHub Actions / spellcheck

Unknown word (SAAAA)

Check warning on line 96 in __tests__/plugin.test.ts

View workflow job for this annotation

GitHub Actions / spellcheck

Unknown word (GAASA)

Check warning on line 96 in __tests__/plugin.test.ts

View workflow job for this annotation

GitHub Actions / spellcheck

Unknown word (CAAA)

Check warning on line 96 in __tests__/plugin.test.ts

View workflow job for this annotation

GitHub Actions / spellcheck

Unknown word (CAAG)

Check warning on line 96 in __tests__/plugin.test.ts

View workflow job for this annotation

GitHub Actions / spellcheck

Unknown word (CAEV)

Check warning on line 96 in __tests__/plugin.test.ts

View workflow job for this annotation

GitHub Actions / spellcheck

Unknown word (GAAI)

Check warning on line 96 in __tests__/plugin.test.ts

View workflow job for this annotation

GitHub Actions / spellcheck

Unknown word (CAAAA)

Check warning on line 96 in __tests__/plugin.test.ts

View workflow job for this annotation

GitHub Actions / spellcheck

Unknown word (GAAG)

Check warning on line 96 in __tests__/plugin.test.ts

View workflow job for this annotation

GitHub Actions / spellcheck

Unknown word (CAAG)
);
});

Expand Down
2 changes: 1 addition & 1 deletion app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"devDependencies": {
"@tsconfig/react-native": "^3.0.0",
"@types/d3-shape": "^3.1.1",
"eslint": "^8.36.0",
"eslint": "^8.0.0-0",
"eslint-plugin-reanimated": "link:../eslintPlugin",
"patch-package": "^7.0.0",
"prettier": "^2.8.7",
Expand Down
4 changes: 2 additions & 2 deletions app/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ __metadata:
languageName: node
linkType: hard

"eslint@npm:^8.36.0":
"eslint@npm:^8.0.0-0":
version: 8.57.0
resolution: "eslint@npm:8.57.0"
dependencies:
Expand Down Expand Up @@ -1716,7 +1716,7 @@ __metadata:
"@tsconfig/react-native": "npm:^3.0.0"
"@types/d3-shape": "npm:^3.1.1"
d3-shape: "npm:^3.2.0"
eslint: "npm:^8.36.0"
eslint: "npm:^8.0.0-0"
eslint-plugin-reanimated: "link:../eslintPlugin"
patch-package: "npm:^7.0.0"
prettier: "npm:^2.8.7"
Expand Down
2 changes: 1 addition & 1 deletion eslintPlugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@typescript-eslint/rule-tester": "^6.19.1",
"@typescript-eslint/utils": "^6.19.1",
"esbuild": "^0.20.0",
"eslint": "^8.56.0",
"eslint": "^8.0.0-0",
"jest": "^29.7.0",
"ts-jest": "^29.1.2",
"typescript": "^5.3.3"
Expand Down
4 changes: 2 additions & 2 deletions eslintPlugin/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2025,7 +2025,7 @@ __metadata:
languageName: node
linkType: hard

"eslint@npm:^8.56.0":
"eslint@npm:^8.0.0-0":
version: 8.57.0
resolution: "eslint@npm:8.57.0"
dependencies:
Expand Down Expand Up @@ -2083,7 +2083,7 @@ __metadata:
"@typescript-eslint/rule-tester": "npm:^6.19.1"
"@typescript-eslint/utils": "npm:^6.19.1"
esbuild: "npm:^0.20.0"
eslint: "npm:^8.56.0"
eslint: "npm:^8.0.0-0"
jest: "npm:^29.7.0"
ts-jest: "npm:^29.1.2"
typescript: "npm:^5.3.3"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
"babel-plugin-module-resolver": "^5.0.0",
"clang-format": "^1.6.0",
"code-tag": "^1.1.0",
"eslint": "^8.56.0",
"eslint": "^8.0.0-0",
"eslint-config-prettier": "^8.3.0",
"eslint-config-standard": "^17.1.0",
"eslint-import-resolver-babel-module": "^5.3.1",
Expand Down
3 changes: 3 additions & 0 deletions plugin/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
types/*
lib/*
build/*
22 changes: 11 additions & 11 deletions plugin/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
module.exports = {
root: true,
extends: '../.eslintrc.js',
extends: [
'standard',
'plugin:@typescript-eslint/recommended', //We overwrite this not to use type-checked rules in plugin
'prettier',
'plugin:import/typescript',
'plugin:react-hooks/recommended',
overrides: [
{
files: ['*.ts'],
parser: '@typescript-eslint/parser',
parserOptions: {
project: true,
tsconfigRootDir: __dirname,
},
},
],
rules: {
'curly': 'error',
},
ignorePatterns: ['**/*.d.ts','jestUtils.ts']};
extends: ['../.eslintrc.js'],
};
2 changes: 1 addition & 1 deletion plugin/build/plugin.js

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

5 changes: 4 additions & 1 deletion plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@
"devDependencies": {
"@react-native/eslint-config": "^0.72.1",
"@types/node": "^18.15.11",
"@typescript-eslint/eslint-plugin": "^7.0.2",
"@typescript-eslint/parser": "^7.0.2",
"esbuild": "^0.17.11",
"eslint": "^8.35.0",
"eslint": "^8.0.0-0",
"eslint-plugin-standard": "^5.0.0",
"prettier": "^2.5.1",
"tsc-watch": "^6.0.0",
"typescript": "^4.1.3"
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion plugin/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module.exports = function (): PluginItem {
try {
fun();
} catch (e) {
throw new Error('[Reanimated] Babel plugin exception: ' + e);
throw new Error(`[Reanimated] Babel plugin exception: ${e as string}`);
}
}

Expand Down
Loading
Loading