mirror of
https://github.com/Kong/insomnia
synced 2024-11-07 22:30:15 +00:00
adds eslint-config-helpers (#3912)
This commit is contained in:
parent
9b7dbe5011
commit
407432aa02
144
.eslintrc.js
144
.eslintrc.js
@ -1,3 +1,13 @@
|
||||
const {
|
||||
ERROR,
|
||||
OFF,
|
||||
SUCCESSOR,
|
||||
TYPESCRIPT_CONVERSION,
|
||||
TYPESCRIPT_EXTENSION,
|
||||
UNKNOWN,
|
||||
WARN,
|
||||
} = require('eslint-config-helpers');
|
||||
|
||||
/** @type { import('eslint').Linter.Config } */
|
||||
module.exports = {
|
||||
parser: '@typescript-eslint/parser',
|
||||
@ -50,44 +60,44 @@ module.exports = {
|
||||
{
|
||||
files: ['*.js'],
|
||||
rules: {
|
||||
'@typescript-eslint/no-var-requires': 'off',
|
||||
'@typescript-eslint/no-var-requires': OFF(UNKNOWN),
|
||||
},
|
||||
},
|
||||
],
|
||||
rules: {
|
||||
'array-bracket-spacing': 'error',
|
||||
'brace-style': 'off', // successor('@typescript-eslint/brace-style')
|
||||
'camelcase': ['error', { allow: ['__export_format', '__export_date', '__export_source'] }],
|
||||
'comma-dangle': ['error', 'always-multiline'],
|
||||
'comma-spacing': 'error',
|
||||
'consistent-return': 'warn',
|
||||
'default-case': 'error',
|
||||
'default-case-last': 'error',
|
||||
'filenames/match-exported': ['error', 'kebab'],
|
||||
'indent': ['error', 2, { SwitchCase: 1 }],
|
||||
'eol-last': ['error', 'always'],
|
||||
'eqeqeq': ['error', 'smart'],
|
||||
'arrow-parens': ['error', 'as-needed'],
|
||||
'arrow-spacing': 'error',
|
||||
'keyword-spacing': 'off', // successor('@typescript-eslint/keyword-spacing')
|
||||
'no-async-promise-executor': 'off',
|
||||
'no-case-declarations': 'off',
|
||||
'no-duplicate-imports': 'off',
|
||||
'no-prototype-builtins': 'off',
|
||||
'no-redeclare': 'off',
|
||||
'no-unused-vars': 'off',
|
||||
'no-use-before-define': 'off',
|
||||
'no-var': 'error',
|
||||
'no-trailing-spaces': 'error',
|
||||
'no-multiple-empty-lines': ['error', { 'max': 1, 'maxEOF': 0 }],
|
||||
'object-curly-spacing': ['error', 'always'],
|
||||
'quotes': 'off',
|
||||
'semi': ['error', 'always'],
|
||||
'space-before-function-paren': ['error', { anonymous: 'never', named: 'never', asyncArrow: 'always' }],
|
||||
'space-infix-ops': 'off', // successor('@typescript-eslint/space-infix-ops')
|
||||
'space-unary-ops': 'error',
|
||||
'space-in-parens': 'error',
|
||||
'spaced-comment': ['error', 'always', {
|
||||
'array-bracket-spacing': ERROR,
|
||||
'brace-style': SUCCESSOR(TYPESCRIPT_EXTENSION),
|
||||
'camelcase': [ERROR, { allow: ['__export_format', '__export_date', '__export_source'] }],
|
||||
'comma-dangle': [ERROR, 'always-multiline'],
|
||||
'comma-spacing': ERROR,
|
||||
'consistent-return': WARN(UNKNOWN),
|
||||
'default-case': ERROR,
|
||||
'default-case-last': ERROR,
|
||||
'filenames/match-exported': [ERROR, 'kebab'],
|
||||
'indent': [ERROR, 2, { SwitchCase: 1 }],
|
||||
'eol-last': [ERROR, 'always'],
|
||||
'eqeqeq': [ERROR, 'smart'],
|
||||
'arrow-parens': [ERROR, 'as-needed'],
|
||||
'arrow-spacing': ERROR,
|
||||
'keyword-spacing': SUCCESSOR(TYPESCRIPT_EXTENSION),
|
||||
'no-async-promise-executor': OFF(UNKNOWN),
|
||||
'no-case-declarations': OFF(UNKNOWN),
|
||||
'no-duplicate-imports': OFF(UNKNOWN),
|
||||
'no-prototype-builtins': OFF(UNKNOWN),
|
||||
'no-redeclare': OFF(UNKNOWN),
|
||||
'no-unused-vars': OFF(UNKNOWN),
|
||||
'no-use-before-define': OFF(UNKNOWN),
|
||||
'no-var': ERROR,
|
||||
'no-trailing-spaces': ERROR,
|
||||
'no-multiple-empty-lines': [ERROR, { 'max': 1, 'maxEOF': 0 }],
|
||||
'object-curly-spacing': [ERROR, 'always'],
|
||||
'quotes': OFF(UNKNOWN),
|
||||
'semi': [ERROR, 'always'],
|
||||
'space-before-function-paren': [ERROR, { anonymous: 'never', named: 'never', asyncArrow: 'always' }],
|
||||
'space-infix-ops': SUCCESSOR(TYPESCRIPT_EXTENSION),
|
||||
'space-unary-ops': ERROR,
|
||||
'space-in-parens': ERROR,
|
||||
'spaced-comment': [ERROR, 'always', {
|
||||
exceptions: ['/', '*', '-', '* '], // for ASCII art :)
|
||||
markers: [
|
||||
'/', // for TypeScript directives, doxygen, vsdoc, etc. (which use `///`)
|
||||
@ -95,48 +105,48 @@ module.exports = {
|
||||
],
|
||||
}],
|
||||
|
||||
'filenames/match-exported': ['error', 'kebab'],
|
||||
'filenames/match-exported': [ERROR, 'kebab'],
|
||||
|
||||
'react/no-find-dom-node': 'off',
|
||||
'react/no-unescaped-entities': 'off', // TSCONVERSION
|
||||
'react/jsx-first-prop-new-line': ['error', 'multiline'],
|
||||
'react/jsx-max-props-per-line': ['error', { maximum: 1, when: 'multiline' }],
|
||||
'react/jsx-uses-react': 'error',
|
||||
'react/jsx-uses-vars': 'error',
|
||||
'react/jsx-indent': ['error', 2],
|
||||
'react/jsx-indent-props': ['error', 2],
|
||||
'react/prop-types': 'off',
|
||||
'react/function-component-definition': ['error', {
|
||||
'react/no-find-dom-node': OFF(UNKNOWN),
|
||||
'react/no-unescaped-entities': OFF(TYPESCRIPT_CONVERSION),
|
||||
'react/jsx-first-prop-new-line': [ERROR, 'multiline'],
|
||||
'react/jsx-max-props-per-line': [ERROR, { maximum: 1, when: 'multiline' }],
|
||||
'react/jsx-uses-react': ERROR,
|
||||
'react/jsx-uses-vars': ERROR,
|
||||
'react/jsx-indent': [ERROR, 2],
|
||||
'react/jsx-indent-props': [ERROR, 2],
|
||||
'react/prop-types': OFF(UNKNOWN),
|
||||
'react/function-component-definition': [ERROR, {
|
||||
'namedComponents': 'arrow-function',
|
||||
'unnamedComponents': 'arrow-function',
|
||||
}],
|
||||
'react/jsx-max-props-per-line': ['error', { 'maximum': 1, 'when': 'multiline' }],
|
||||
'react/jsx-closing-bracket-location': ['error', 'line-aligned'],
|
||||
'react/prefer-stateless-function': 'warn', // TODO: fix this and change to error
|
||||
'react/jsx-key': ['error', { 'checkFragmentShorthand': true }],
|
||||
'react/no-array-index-key': 'warn',
|
||||
'react/self-closing-comp': 'error',
|
||||
'react/jsx-max-props-per-line': [ERROR, { 'maximum': 1, 'when': 'multiline' }],
|
||||
'react/jsx-closing-bracket-location': [ERROR, 'line-aligned'],
|
||||
'react/prefer-stateless-function': WARN(UNKNOWN), // TODO: fix this and change to error
|
||||
'react/jsx-key': [ERROR, { 'checkFragmentShorthand': true }],
|
||||
'react/no-array-index-key': WARN(UNKNOWN),
|
||||
'react/self-closing-comp': ERROR,
|
||||
|
||||
'react-hooks/exhaustive-deps': ['error', {
|
||||
'react-hooks/exhaustive-deps': [ERROR, {
|
||||
// From react-use https://github.com/streamich/react-use/issues/1703#issuecomment-770972824
|
||||
'additionalHooks': '^use(Async|AsyncFn|AsyncRetry|Debounce|UpdateEffect|IsomorphicLayoutEffect|DeepCompareEffect|ShallowCompareEffect)$',
|
||||
}],
|
||||
'react-hooks/rules-of-hooks': 'error',
|
||||
'react-hooks/rules-of-hooks': ERROR,
|
||||
|
||||
'@typescript-eslint/array-type': ['error', { default: 'array', readonly: 'array' }],
|
||||
'@typescript-eslint/ban-types': 'off',
|
||||
'@typescript-eslint/brace-style': ['error', '1tbs', { 'allowSingleLine': true }],
|
||||
'@typescript-eslint/consistent-type-definitions': ['error', 'interface'],
|
||||
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
||||
'@typescript-eslint/keyword-spacing': 'error',
|
||||
'@typescript-eslint/no-empty-function': 'off',
|
||||
'@typescript-eslint/no-namespace': ['error', { allowDeclarations: true }],
|
||||
'@typescript-eslint/no-redeclare': 'error',
|
||||
'@typescript-eslint/no-unused-vars': ['error', { ignoreRestSiblings: true }],
|
||||
'@typescript-eslint/no-use-before-define': 'error',
|
||||
'@typescript-eslint/space-infix-ops': 'error',
|
||||
'@typescript-eslint/quotes': ['error', 'single', { avoidEscape: true }],
|
||||
'@typescript-eslint/array-type': [ERROR, { default: 'array', readonly: 'array' }],
|
||||
'@typescript-eslint/ban-types': OFF(UNKNOWN),
|
||||
'@typescript-eslint/brace-style': [ERROR, '1tbs', { 'allowSingleLine': true }],
|
||||
'@typescript-eslint/consistent-type-definitions': [ERROR, 'interface'],
|
||||
'@typescript-eslint/explicit-module-boundary-types': OFF(UNKNOWN),
|
||||
'@typescript-eslint/keyword-spacing': ERROR,
|
||||
'@typescript-eslint/no-empty-function': OFF(UNKNOWN),
|
||||
'@typescript-eslint/no-namespace': [ERROR, { allowDeclarations: true }],
|
||||
'@typescript-eslint/no-redeclare': ERROR,
|
||||
'@typescript-eslint/no-unused-vars': [ERROR, { ignoreRestSiblings: true }],
|
||||
'@typescript-eslint/no-use-before-define': ERROR,
|
||||
'@typescript-eslint/space-infix-ops': ERROR,
|
||||
'@typescript-eslint/quotes': [ERROR, 'single', { avoidEscape: true }],
|
||||
|
||||
'simple-import-sort/imports': 'error',
|
||||
'simple-import-sort/imports': ERROR,
|
||||
},
|
||||
};
|
||||
|
6
package-lock.json
generated
6
package-lock.json
generated
@ -7614,6 +7614,12 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"eslint-config-helpers": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint-config-helpers/-/eslint-config-helpers-1.1.0.tgz",
|
||||
"integrity": "sha512-CquyZ9thHewhoEsGP9Ty3szu/Jx2Dg+U7yOY2Se6fuu0GwGtdP4jpZnwcSekeGcz6C3Iknk9QnROGoCCDABJwg==",
|
||||
"dev": true
|
||||
},
|
||||
"eslint-import-resolver-node": {
|
||||
"version": "0.3.4",
|
||||
"resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.4.tgz",
|
||||
|
@ -55,6 +55,7 @@
|
||||
"babel-plugin-styled-components": "^1.12.0",
|
||||
"cross-env": "^7.0.2",
|
||||
"eslint": "^7.29.0",
|
||||
"eslint-config-helpers": "^1.1.0",
|
||||
"eslint-plugin-filenames": "^1.3.2",
|
||||
"eslint-plugin-html": "^6.1.2",
|
||||
"eslint-plugin-import": "^2.23.4",
|
||||
|
@ -1,3 +1,5 @@
|
||||
const { ERROR, OFF, UNKNOWN, TYPESCRIPT_CONVERSION } = require('eslint-config-helpers');
|
||||
|
||||
/** @type { import('eslint').Linter.Config } */
|
||||
module.exports = {
|
||||
extends: '../../.eslintrc.js',
|
||||
@ -7,12 +9,12 @@ module.exports = {
|
||||
},
|
||||
},
|
||||
rules: {
|
||||
'filenames/match-exported': 'off',
|
||||
camelcase: 'off',
|
||||
'@typescript-eslint/no-use-before-define': 'off', // TSCONVERSION
|
||||
'@typescript-eslint/no-explicit-any': 'off', // TSCONVERSION
|
||||
'react/no-find-dom-node': 'off',
|
||||
'no-restricted-properties': ['error', {
|
||||
'filenames/match-exported': OFF(UNKNOWN),
|
||||
camelcase: OFF(UNKNOWN),
|
||||
'@typescript-eslint/no-use-before-define': OFF(TYPESCRIPT_CONVERSION),
|
||||
'@typescript-eslint/no-explicit-any': OFF(TYPESCRIPT_CONVERSION),
|
||||
'react/no-find-dom-node': OFF(UNKNOWN),
|
||||
'no-restricted-properties': [ERROR, {
|
||||
property: 'openExternal',
|
||||
message: 'use the `clickLink` function in `electron-helpers.ts` instead. see https://security.stackexchange.com/questions/225799/dangers-of-electrons-shell-openexternal-on-untrusted-content for more information.',
|
||||
}],
|
||||
|
@ -1,3 +1,5 @@
|
||||
const { OFF, TYPESCRIPT_CONVERSION } = require('eslint-config-helpers');
|
||||
|
||||
/** @type { import('eslint').Linter.Config } */
|
||||
module.exports = {
|
||||
extends: '../../.eslintrc.js',
|
||||
@ -7,6 +9,6 @@ module.exports = {
|
||||
},
|
||||
},
|
||||
rules: {
|
||||
'@typescript-eslint/no-explicit-any': 'off', // TSCONVERSION
|
||||
'@typescript-eslint/no-explicit-any': OFF(TYPESCRIPT_CONVERSION),
|
||||
},
|
||||
};
|
||||
|
@ -1,8 +1,10 @@
|
||||
const { ERROR, OFF, TYPESCRIPT_CONVERSION } = require('eslint-config-helpers');
|
||||
|
||||
/** @type { import('eslint').Linter.Config } */
|
||||
module.exports = {
|
||||
extends: '../../.eslintrc.js',
|
||||
rules: {
|
||||
'@typescript-eslint/no-use-before-define': 'off', // TSCONVERSION
|
||||
camelcase: ['error', { allow: ['__export_format', '__export_date', '__export_source', '_postman_variable_scope'] }],
|
||||
'@typescript-eslint/no-use-before-define': OFF(TYPESCRIPT_CONVERSION),
|
||||
camelcase: [ERROR, { allow: ['__export_format', '__export_date', '__export_source', '_postman_variable_scope'] }],
|
||||
},
|
||||
};
|
||||
|
@ -1,7 +1,9 @@
|
||||
const { OFF, TYPESCRIPT_CONVERSION } = require('eslint-config-helpers');
|
||||
|
||||
/** @type { import('eslint').Linter.Config } */
|
||||
module.exports = {
|
||||
extends: '../../.eslintrc.js',
|
||||
rules: {
|
||||
'@typescript-eslint/no-use-before-define': 'off', // TSCONVERSION
|
||||
'@typescript-eslint/no-use-before-define': OFF(TYPESCRIPT_CONVERSION),
|
||||
},
|
||||
};
|
||||
|
@ -1,7 +1,9 @@
|
||||
const { OFF, TYPESCRIPT_CONVERSION } = require('eslint-config-helpers');
|
||||
|
||||
/** @type { import('eslint').Linter.Config } */
|
||||
module.exports = {
|
||||
extends: '../../.eslintrc.js',
|
||||
rules: {
|
||||
'@typescript-eslint/no-use-before-define': 'off', // TSCONVERSION
|
||||
'@typescript-eslint/no-use-before-define': OFF(TYPESCRIPT_CONVERSION),
|
||||
},
|
||||
};
|
||||
|
@ -1,7 +1,9 @@
|
||||
const { OFF, TYPESCRIPT_CONVERSION } = require('eslint-config-helpers');
|
||||
|
||||
/** @type { import('eslint').Linter.Config } */
|
||||
module.exports = {
|
||||
extends: '../../.eslintrc.js',
|
||||
rules: {
|
||||
'@typescript-eslint/no-use-before-define': 'off', // TSCONVERSION
|
||||
'@typescript-eslint/no-use-before-define': OFF(TYPESCRIPT_CONVERSION),
|
||||
},
|
||||
};
|
||||
|
@ -1,7 +1,9 @@
|
||||
const { OFF, TYPESCRIPT_CONVERSION } = require('eslint-config-helpers');
|
||||
|
||||
/** @type { import('eslint').Linter.Config } */
|
||||
module.exports = {
|
||||
extends: '../../.eslintrc.js',
|
||||
rules: {
|
||||
'@typescript-eslint/no-use-before-define': 'off', // TSCONVERSION
|
||||
'@typescript-eslint/no-use-before-define': OFF(TYPESCRIPT_CONVERSION),
|
||||
},
|
||||
};
|
||||
|
@ -1,7 +1,9 @@
|
||||
const { OFF, TYPESCRIPT_CONVERSION } = require('eslint-config-helpers');
|
||||
|
||||
/** @type { import('eslint').Linter.Config } */
|
||||
module.exports = {
|
||||
extends: '../../.eslintrc.js',
|
||||
rules: {
|
||||
'@typescript-eslint/no-use-before-define': 'off', // TSCONVERSION
|
||||
'@typescript-eslint/no-use-before-define': OFF(TYPESCRIPT_CONVERSION),
|
||||
},
|
||||
};
|
||||
|
@ -1,10 +1,12 @@
|
||||
const { OFF, TYPESCRIPT_CONVERSION } = require('eslint-config-helpers');
|
||||
|
||||
/** @type { import('eslint').Linter.Config } */
|
||||
module.exports = {
|
||||
extends: '../../.eslintrc.js',
|
||||
rules: {
|
||||
camelcase: 'off',
|
||||
'@typescript-eslint/no-explicit-any': 'off', // TSCONVERSION
|
||||
'@typescript-eslint/no-empty-interface': 'off', // TSCONVERSION
|
||||
'@typescript-eslint/no-use-before-define': 'off', // TSCONVERSION
|
||||
'@typescript-eslint/no-explicit-any': OFF(TYPESCRIPT_CONVERSION),
|
||||
'@typescript-eslint/no-empty-interface': OFF(TYPESCRIPT_CONVERSION),
|
||||
'@typescript-eslint/no-use-before-define': OFF(TYPESCRIPT_CONVERSION),
|
||||
},
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user