diff --git a/.eslintrc.js b/.eslintrc.js index 3b353d4..0502a50 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,7 +1,6 @@ 'use strict'; module.exports = { - globals: {}, rules: { 'valid-jsdoc': [ 'error', diff --git a/esm.js b/esm.js index b91ad7d..c40a413 100644 --- a/esm.js +++ b/esm.js @@ -1,67 +1,10 @@ 'use strict'; module.exports = { - globals: {}, rules: { - 'valid-jsdoc': [ - 'error', - { - requireReturn: false, - requireReturnDescription: false, - preferType: { - String: 'string', - Number: 'number', - Boolean: 'boolean', - Function: 'function', - object: 'Object', - date: 'Date', - error: 'Error', - }, - prefer: { - return: 'returns', - }, - }, - ], - strict: ['error', 'safe'], - 'linebreak-style': ['error', 'unix'], - 'no-await-in-loop': 'off', - 'arrow-parens': ['error', 'always'], - 'func-names': 0, - 'global-require': 0, - 'no-param-reassign': 'off', - 'no-continue': 'off', - 'lines-between-class-members': 'off', - 'no-fallthrough': 'off', - 'no-case-declarations': 'off', - 'default-case': 'off', - 'max-classes-per-file': 'off', - 'consistent-return': 'off', - 'class-methods-use-this': 'off', - 'max-len': [ - 'error', - { - code: 120, - tabWidth: 2, - comments: 120, - ignoreTemplateLiterals: true, - ignoreStrings: true, - ignoreRegExpLiterals: true, - }, - ], - 'import/no-unresolved': 0, - 'import/no-extraneous-dependencies': ['error', { devDependencies: ['**/*.test.js', '**/*.spec.js'] }], - 'no-null/no-null': 2, 'import/extensions': 0, - 'prettier/prettier': [ - 'error', - {}, - { - usePrettierrc: true, - }, - ], }, - extends: ['airbnb-base', 'plugin:prettier/recommended'], - plugins: ['no-null'], + extends: ['@wfcd'], parser: '@babel/eslint-parser', parserOptions: { sourceType: 'module', diff --git a/package.json b/package.json index 5df97bd..95f72c5 100644 --- a/package.json +++ b/package.json @@ -26,21 +26,25 @@ "exports": { ".": "./index.js", "./esm": "./esm.js", - "./prettier": "./prettier.config.js" + "./prettier": "./prettier.config.js", + "./typescript": "./typescript.js" }, "peerDependencies": { - "@babel/core": "^7.17.8", - "@babel/eslint-parser": "^7.17.0", - "@babel/plugin-proposal-class-properties": "^7.16.7", - "@babel/plugin-proposal-private-methods": "^7.16.11", - "@babel/preset-env": "^7.16.11", - "eslint": "^7.5.0", - "eslint-config-airbnb-base": "^14.2.1", + "@babel/core": "^7.19.1", + "@babel/eslint-parser": "^7.19.1", + "@babel/plugin-proposal-class-properties": "^7.18.6", + "@babel/plugin-proposal-private-methods": "^7.18.6", + "@babel/preset-env": "^7.19.1", + "@typescript-eslint/eslint-plugin": "^5.38.0", + "@typescript-eslint/parser": "^5.38.0", + "eslint": "^8.24.0", + "eslint-config-airbnb-base": "^15.0.0", "eslint-config-prettier": "^8.5.0", - "eslint-plugin-import": "^2.25.3", + "eslint-config-airbnb-typescript": "17.0.0", + "eslint-plugin-import": "^2.26.0", "eslint-plugin-no-null": "^1.0.2", - "eslint-plugin-prettier": "^4.0.0", - "prettier": "^2.6.1" + "eslint-plugin-prettier": "^4.2.1", + "prettier": "^2.7.1" }, "engines": { "npm": ">=7" diff --git a/typescript.js b/typescript.js new file mode 100644 index 0000000..e78013a --- /dev/null +++ b/typescript.js @@ -0,0 +1,23 @@ +'use strict'; + +module.exports = { + extends: [ + '@wfcd/eslint-config/esm', + 'airbnb-typescript/base', + 'plugin:@typescript-eslint/recommended', + 'plugin:@typescript-eslint/recommended-requiring-type-checking', + ], + rules: { + 'impot/no-unresolved': 'off', + }, + parserOptions: { + sourceType: 'module', + ecmaVersion: 6, + ecmaFeatures: { + modules: true, + }, + babelOptions: { + plugins: ['@babel/plugin-proposal-class-properties', '@babel/plugin-proposal-private-methods'], + }, + }, +};