Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
* LICENSE file in the root directory of this source tree.
*
* @format
*/
const typescriptEslintRecommended = require('@typescript-eslint/eslint-plugin/dist/configs/recommended.json');
const typescriptEslintPrettier = require('eslint-config-prettier/@typescript-eslint');
module.exports = {
extends: ['@react-native-community'],
overrides: [
{
files: ['*.ts', '*.tsx'],
// Apply the recommended Typescript defaults and the prettier overrides to all Typescript files
rules: Object.assign(
typescriptEslintRecommended.rules,
typescriptEslintPrettier.rules,
{
'@typescript-eslint/explicit-member-accessibility': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/ban-ts-ignore': 'off',
'react-native/no-inline-styles': 'off',
},
),
},
],
};
files: ['*.ts'],
parser: '@typescript-eslint/parser',
// NOTE: Workaround for no nested extends possible.
// See https://github.com/eslint/eslint/issues/8813.
// Working solution would be following, if we had nested extends:
// ```
// extends: [
// 'airbnb-base',
// 'plugin:@typescript-eslint/recommended',
// 'prettier/@typescript-eslint',
// 'prettier',
// ],
// ```
plugins: ['@typescript-eslint', 'prettier'],
rules: Object.assign(
typescriptEslintRecommended.rules,
typescriptEslintPrettier.rules,
{
'@typescript-eslint/explicit-function-return-type': 'error',
},
),
},
],
};
* LICENSE file in the root directory of this source tree.
*
* @format
*/
const typescriptEslintRecommended = require('@typescript-eslint/eslint-plugin/dist/configs/recommended.json');
const typescriptEslintPrettier = require('eslint-config-prettier/@typescript-eslint');
module.exports = {
extends: ['@react-native-community'],
overrides: [
{
files: ['*.ts', '*.tsx'],
// Apply the recommended Typescript defaults and the prettier overrides to all Typescript files
rules: Object.assign(
typescriptEslintRecommended.rules,
typescriptEslintPrettier.rules,
{
'@typescript-eslint/explicit-member-accessibility': 'off',
},
),
},
{
files: ['example/**/*.ts', 'example/**/*.tsx'],
rules: {
// Turn off rules which are useless and annoying for the example files files
'@typescript-eslint/explicit-function-return-type': 'off',
'react-native/no-inline-styles': 'off',
},
},
{
files: ['**/__tests__/**/*.ts', '**/*.spec.ts'],
files: ['*.ts', '*.tsx'],
parser: '@typescript-eslint/parser',
// NOTE: Workaround for no nested extends possible.
// See https://github.com/eslint/eslint/issues/8813.
// Working solution would be following, if we had nested extends:
// ```
// extends: [
// 'airbnb-base',
// 'plugin:@typescript-eslint/recommended',
// 'prettier/@typescript-eslint',
// 'prettier',
// ],
// ```
plugins: ['@typescript-eslint', 'prettier'],
rules: Object.assign(
typescriptEslintRecommended.rules,
typescriptEslintPrettier.rules,
{
'@typescript-eslint/explicit-function-return-type': 'error',
},
),
},
{
files: [
'setupTest.js',
'setupTest.ts',
'*.spec.js',
'*.spec.ts',
'*.spec.tsx',
],
env: {
jest: true,
const typescriptEslintRecommended = require('@typescript-eslint/eslint-plugin/dist/configs/recommended.json');
const typescriptEslintPrettier = require('eslint-config-prettier/@typescript-eslint');
module.exports = {
extends: ['@react-native-community'],
overrides: [
{
files: ['./mock.js'],
env: {jest: true},
},
{
files: ['*.ts', '*.tsx'],
// Apply the recommended Typescript defaults and the prettier overrides to all Typescript files
rules: Object.assign(
typescriptEslintRecommended.rules,
typescriptEslintPrettier.rules,
{
'@typescript-eslint/explicit-member-accessibility': 'off',
'@typescript-eslint/no-empty-function': 'off',
},
),
},
{
files: ['example/**/*.ts', 'example/**/*.tsx'],
rules: {
// Turn off rules which are useless and annoying for the example files files
'@typescript-eslint/explicit-function-return-type': 'off',
'react-native/no-inline-styles': 'off',
},
},
],
},
},
plugins: [
"@typescript-eslint",
"@typescript-eslint/tslint",
"react",
"jsx-a11y",
],
settings: {
react: {
version: "detect",
}
},
rules: Object.assign(
typescriptEslintRecommended.rules,
typescriptRecommended.rules,
typescriptEslintPrettier.rules,
react.rules,
jsxA11y.rules,
reactPrettier.rules,
{
"@typescript-eslint/adjacent-overload-signatures": "error",
// TODO: (cvle) change `readonly` param to `array-simple` when upgraded typescript.
"@typescript-eslint/array-type": ["error", { "default": "array-simple", "readonly": "generic"}],
"@typescript-eslint/ban-types": "error",
"@typescript-eslint/camelcase": "off",
"@typescript-eslint/consistent-type-assertions": "error",
"@typescript-eslint/consistent-type-definitions": "error",
"@typescript-eslint/class-name-casing": "error",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-member-accessibility": [
"error",
___emitter: false,
},
},
{
files: ["**/cypress/integration/**/*", "**/cypress/support/**/*"],
globals: {
cy: false,
Cypress: false,
},
},
{
files: ["*.ts", "*.tsx"],
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint/eslint-plugin"],
rules: {
...TSEslint.configs.recommended.rules,
// This rule ensures that typescript types do not have semicolons
// at the end of their lines, since our prettier setup is to have no semicolons
// e.g.,
// interface Foo {
// - baz: string;
// + baz: string
// }
"@typescript-eslint/member-delimiter-style": [
"error",
{
multiline: {
delimiter: "none",
},
},
],
// This ensures all interfaces are named with an I as a prefix
"no-unused-vars": "off",
"@swissquote/swissquote/@typescript-eslint/no-unused-vars": [
"error",
{ args: "none", vars: "local", ignoreRestSiblings: true }
],
// Overrides of TypeScript recommended
"@swissquote/swissquote/@typescript-eslint/explicit-function-return-type": "off",
"@swissquote/swissquote/@typescript-eslint/explicit-member-accessibility": "off",
"@swissquote/swissquote/@typescript-eslint/no-empty-function": "warn",
}
};
addMissingRules(
require("@typescript-eslint/eslint-plugin").configs.recommended.rules,
module.exports.rules,
Object.keys(require("./typescript").rules)
);
'import/no-extraneous-dependencies': 'off',
'no-console': 'off',
'jest/valid-describe': 'off',
'jest/no-test-prefixes': 'off',
'jest/no-identical-title': 'off',
},
globals: {
step: false,
},
},
merge(
// ESLint doesn't allow the `extends` field inside `overrides`, so we need to compose
// the TypeScript config manually using internal bits from various plugins
{},
// base TypeScript config: parser options, add plugin with rules
require( '@typescript-eslint/eslint-plugin' ).configs.base,
// basic recommended rules config from the TypeScript plugin
{ rules: require( '@typescript-eslint/eslint-plugin' ).configs.recommended.rules },
// Prettier rules config
require( 'eslint-config-prettier/@typescript-eslint' ),
// Our own overrides
{
files: [ '**/*.ts', '**/*.tsx' ],
rules: {
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-member-accessibility': 'off',
'@typescript-eslint/no-unused-vars': [ 'error', { ignoreRestSiblings: true } ],
'@typescript-eslint/no-use-before-define': [
'error',
{ functions: false, typedefs: false },
],
'no-use-before-define': 'off',
'jest/valid-describe': 'off',
'jest/no-test-prefixes': 'off',
'jest/no-identical-title': 'off',
},
globals: {
step: false,
},
},
merge(
// ESLint doesn't allow the `extends` field inside `overrides`, so we need to compose
// the TypeScript config manually using internal bits from various plugins
{},
// base TypeScript config: parser options, add plugin with rules
require( '@typescript-eslint/eslint-plugin' ).configs.base,
// basic recommended rules config from the TypeScript plugin
{ rules: require( '@typescript-eslint/eslint-plugin' ).configs.recommended.rules },
// Prettier rules config
require( 'eslint-config-prettier/@typescript-eslint' ),
// Our own overrides
{
files: [ '**/*.ts', '**/*.tsx' ],
rules: {
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-member-accessibility': 'off',
'@typescript-eslint/no-unused-vars': [ 'error', { ignoreRestSiblings: true } ],
'@typescript-eslint/no-use-before-define': [
'error',
{ functions: false, typedefs: false },
],
'no-use-before-define': 'off',
'@typescript-eslint/no-var-requires': 'off',
// REST API objects include underscores