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

replace tslint with eslint for typescript #10900

Merged
merged 16 commits into from
Jan 25, 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
3 changes: 0 additions & 3 deletions .babelrc

This file was deleted.

280 changes: 280 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,280 @@
/*
👋 Hi! This file was autogenerated by tslint-to-eslint-config.
https://github.com/typescript-eslint/tslint-to-eslint-config

It represents the closest reasonable ESLint configuration to this
project's original TSLint configuration.

We recommend eventually switching this configuration to extend from
the recommended rulesets in typescript-eslint.
https://github.com/typescript-eslint/tslint-to-eslint-config/blob/master/docs/FAQs.md

Happy linting! 💖
*/
module.exports = {
env: {
es6: true,
node: true,
},
ignorePatterns: [
'**/node_modules/**',
'**/coverage/**',
'**/build/**',
'**/dist/**',
'**/lib/**',
'**/*.js',
'packages/protocol/build/**',
'packages/protocol/types/**',
'/packages/protocol/migrations_ts/**',
'packages/protocol/scripts/truffle/**',
// ignoring any files that for which "TSConfig does not include this file" error was given
'packages/protocol/scripts/utils.test.ts',
'packages/protocol/test',
'packages/protocol/truffle-config.js',
'packages/protocol/truffle-config0.8.js',
'packages/protocol/truffle-config-parent.js',
'packages/protocol/abis',
'packages/protocol/wagmi.config.ts',
'**/jest.config.js',
],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-type-checked',
],
parser: '@typescript-eslint/parser',
parserOptions: {
tsconfigRootDir: `${__dirname}`,
project: ['./packages/*/tsconfig.json'],
sourceType: 'module',
},
plugins: ['eslint-plugin-import', '@typescript-eslint'],
root: true,
rules: {
'@typescript-eslint/no-unused-vars': [
'error',
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
],
// i dont trust this rule
'@typescript-eslint/no-unnecessary-type-assertion': 'off',
'@typescript-eslint/no-misused-promises': 'off',
'@typescript-eslint/adjacent-overload-signatures': 'error',
'@typescript-eslint/array-type': [
'error',
{
default: 'array',
},
],
'@typescript-eslint/ban-types': [
'error',
{
types: {
Object: {
message: 'Avoid using the `Object` type. Did you mean `object`?',
},
Function: {
message:
'Avoid using the `Function` type. Prefer a specific function type, like `() => void`.',
},
Boolean: {
message: 'Avoid using the `Boolean` type. Did you mean `boolean`?',
},
Number: {
message: 'Avoid using the `Number` type. Did you mean `number`?',
},
String: {
message: 'Avoid using the `String` type. Did you mean `string`?',
},
Symbol: {
message: 'Avoid using the `Symbol` type. Did you mean `symbol`?',
},
},
},
],
'@typescript-eslint/consistent-type-assertions': 'error',
'@typescript-eslint/dot-notation': 'error',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-member-accessibility': [
'off',
{
accessibility: 'explicit',
},
],
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/indent': 'off',
'@typescript-eslint/member-delimiter-style': [
'off',
{
multiline: {
delimiter: 'none',
requireLast: true,
},
singleline: {
delimiter: 'semi',
requireLast: false,
},
},
],
'@typescript-eslint/naming-convention': [
'off',
{
selector: 'variable',
format: ['camelCase', 'UPPER_CASE'],
leadingUnderscore: 'forbid',
trailingUnderscore: 'forbid',
},
],
'@typescript-eslint/no-empty-function': 'error',
'@typescript-eslint/no-empty-interface': 'error',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-floating-promises': 'error',
'@typescript-eslint/no-misused-new': 'error',
'@typescript-eslint/no-namespace': 'error',
'@typescript-eslint/no-parameter-properties': 'off',
'@typescript-eslint/no-shadow': [
'error',
{
hoist: 'all',
},
],
'@typescript-eslint/no-this-alias': 'error',
'@typescript-eslint/no-unused-expressions': 'error',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/prefer-for-of': 'error',
'@typescript-eslint/prefer-function-type': 'error',
'@typescript-eslint/prefer-namespace-keyword': 'error',
'@typescript-eslint/quotes': 'off',
'@typescript-eslint/semi': ['off', null],
'@typescript-eslint/triple-slash-reference': [
'error',
{
path: 'always',
types: 'prefer-import',
lib: 'always',
},
],
'@typescript-eslint/type-annotation-spacing': 'off',
'@typescript-eslint/typedef': 'off',
'@typescript-eslint/unified-signatures': 'error',
'arrow-parens': ['off', 'always'],
'brace-style': ['off', 'off'],
'comma-dangle': 'off',
complexity: 'off',
'constructor-super': 'error',
'dot-notation': 'off',
'eol-last': 'off',
eqeqeq: ['error', 'smart'],
'guard-for-in': 'error',
'id-denylist': 'error',
'id-match': 'error',
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: false,
},
],
'import/no-internal-modules': 'off',
indent: 'off',
'linebreak-style': 'off',
'max-classes-per-file': ['error', 1],
'max-len': 'off',
'new-parens': 'off',
'newline-per-chained-call': 'off',
'no-bitwise': 'error',
'no-caller': 'error',
'no-cond-assign': 'error',
'no-console': [
'error',
{
allow: [
'warn',
'dir',
'time',
'timeEnd',
'timeLog',
'trace',
'assert',
'clear',
'count',
'countReset',
'group',
'groupEnd',
'table',
'debug',
'info',
'dirxml',
'error',
'groupCollapsed',
'Console',
'profile',
'profileEnd',
'timeStamp',
'context',
],
},
],
'no-constant-condition': 'error',
'no-debugger': 'error',
'no-duplicate-case': 'error',
'no-duplicate-imports': 'error',
'no-empty': 'error',
'no-empty-function': 'off',
'no-eval': 'error',
'no-extra-bind': 'error',
'no-extra-semi': 'off',
'no-fallthrough': 'off',
'no-invalid-this': 'off',
'no-irregular-whitespace': 'off',
'no-multiple-empty-lines': 'off',
'no-new-func': 'error',
'no-new-wrappers': 'error',
'no-redeclare': 'error',
'no-restricted-syntax': ['error', 'ForInStatement'],
'no-return-await': 'error',
'no-sequences': 'error',
'no-shadow': 'off',
'no-sparse-arrays': 'error',
'no-template-curly-in-string': 'error',
'no-throw-literal': 'error',
'no-trailing-spaces': 'off',
'no-undef-init': 'error',
'no-underscore-dangle': 'error',
'no-unsafe-finally': 'error',
'no-unused-expressions': 'off',
'no-unused-labels': 'error',
'no-use-before-define': 'off',
'no-var': 'error',
'object-shorthand': 'error',
'one-var': ['off', 'never'],
'padded-blocks': [
'off',
{
blocks: 'never',
},
{
allowSingleLineBlocks: true,
},
],
'prefer-const': 'error',
'prefer-object-spread': 'error',
'quote-props': 'off',
quotes: 'off',
radix: 'error',
semi: 'off',
'space-before-function-paren': 'off',
'space-in-parens': ['off', 'never'],
'spaced-comment': [
'error',
'always',
{
markers: ['/'],
},
],
'use-isnan': 'error',
'valid-typeof': 'off',
},
}
6 changes: 5 additions & 1 deletion .github/workflows/publish-contracts-abi-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,11 @@ jobs:
env:
RELEASE_TYPE: ${{ env.RELEASE_TYPE }}
RELEASE_VERSION: ${{ env.RELEASE_VERSION }}

# a safety check especially useful if some package is upgraded
- name: 'Validate ABIS Exports'
shell: bash
run: yarn validate_abis_exports
working-directory: packages/protocol
- name: Publish @celo/contracts
run: |
cat package.json
Expand Down
1 change: 0 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
"javascript.format.enable": false,
"editor.tabSize": 2,
"editor.detectIndentation": false,
"tslint.jsEnable": true,
"typescript.tsdk": "node_modules/typescript/lib",
"[javascriptreact][typescript][typescriptreact]": {
"editor.codeActionsOnSave": {
Expand Down
4 changes: 0 additions & 4 deletions SETUP.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,5 @@ yarn build --ignore docs
> github.com host key. Clone a repo or add the github host key to
> `~/.ssh/known_hosts` and then try again.

> When removing a dependency via `yarn remove some-package`, be sure to also run `yarn postinstall` so
> you aren't left with freshly unpackaged modules. This is because we use `patch-package`
> and the `postinstall` step which uses it is not automatically run after using `yarn remove`.

> The docs package relies on gitbook which has problems off of a fresh install. Running
> `yarn build --ignore docs` is a known workaround.
16 changes: 9 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"check-licenses": "yarn licenses list --prod | grep '\\(─ GPL\\|─ (GPL-[1-9]\\.[0-9]\\+ OR GPL-[1-9]\\.[0-9]\\+)\\)' && echo 'Found GPL license(s). Use 'yarn licenses list --prod' to look up the offending package' || echo 'No GPL licenses found'",
"report-coverage": "yarn run lerna run test-coverage",
"test:watch": "node node_modules/jest/bin/jest.js --watch",
"postinstall": "yarn run lerna run postinstall && patch-package && yarn keys:decrypt",
"postinstall": "yarn run lerna run postinstall",
"keys:decrypt": "bash scripts/key_placer.sh decrypt",
"keys:encrypt": "bash scripts/key_placer.sh encrypt",
"check:packages": "node ./scripts/check-packages.js",
Expand All @@ -38,28 +38,30 @@
]
},
"devDependencies": {
"@tsconfig/recommended": "^1.0.3",
"@types/jest": "^29.1.1",
"@types/node": "18.7.16",
"@types/prompt": "1.1.1",
"@types/semver": "7.3.8",
"@typescript-eslint/eslint-plugin": "^6.19.0",
"@typescript-eslint/parser": "^6.19.0",
"codecov": "^3.6.5",
"colors": "1.4.0",
"eslint": "^8.56.0",
"eslint-plugin-import": "^2.29.1",
"husky": "^8.0.0",
"jest": "^29.0.2",
"lerna": "^5.5.0",
"patch-package": "^6.2.2",
"prettier": "^2.7.1",
"prettier-plugin-solidity": "1.0.0-alpha.35",
"pretty-quick": "^2.0.1",
"prompt": "1.2.0",
"semver": "7.3.5",
"solc": "0.5.8",
"ts-jest": "^29.0.0",
"ts-node": "^10.9.1",
"ts-node": "^10.9.2",
"tsconfig-paths": "^3.8.0",
"tslint": "^5.20.0",
"typescript": "4.7.4",
"typescript-tslint-plugin": "^0.5.4"
"typescript": "^5.3.3"
},
"resolutions": {
"ganache": "npm:@soloseng/ganache@7.8.0-beta.1",
Expand All @@ -68,4 +70,4 @@
"@types/bn.js": "4.11.6",
"bignumber.js": "9.0.0"
}
}
}
8 changes: 8 additions & 0 deletions packages/celotool/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = {
rules: {
'no-underscore-dangle': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'no-bitwise': 'off',
},
}
Loading
Loading