|
| 1 | +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. |
| 2 | +// SPDX-License-Identifier: Apache-2.0 |
| 3 | +const eslint = require('@eslint/js'); |
| 4 | +const tsEslint = require('typescript-eslint'); |
| 5 | +const unicornPlugin = require('eslint-plugin-unicorn'); |
| 6 | +const headerPlugin = require('eslint-plugin-header'); |
| 7 | +const prettierPlugin = require('eslint-plugin-prettier'); |
| 8 | +const prettierConfig = require('eslint-config-prettier'); |
| 9 | + |
| 10 | +// https://github.com/Stuk/eslint-plugin-header/issues/57 |
| 11 | +headerPlugin.rules.header.meta.schema = false; |
| 12 | + |
| 13 | +module.exports = [ |
| 14 | + { |
| 15 | + ignores: ['node_modules/**', 'lib/**', '**/dist/**', 'src/converter/test/outputs/**', 'test/mock-test-utils/**'], |
| 16 | + }, |
| 17 | + eslint.configs.recommended, |
| 18 | + ...tsEslint.configs.recommended, |
| 19 | + prettierConfig, |
| 20 | + { |
| 21 | + files: ['**/*.{js,ts,tsx}'], |
| 22 | + languageOptions: { |
| 23 | + parser: tsEslint.parser, |
| 24 | + parserOptions: { |
| 25 | + ecmaVersion: 2018, |
| 26 | + sourceType: 'module', |
| 27 | + }, |
| 28 | + globals: { |
| 29 | + console: 'readonly', |
| 30 | + process: 'readonly', |
| 31 | + __dirname: 'readonly', |
| 32 | + __filename: 'readonly', |
| 33 | + module: 'readonly', |
| 34 | + require: 'readonly', |
| 35 | + exports: 'readonly', |
| 36 | + Buffer: 'readonly', |
| 37 | + setTimeout: 'readonly', |
| 38 | + clearTimeout: 'readonly', |
| 39 | + setInterval: 'readonly', |
| 40 | + clearInterval: 'readonly', |
| 41 | + }, |
| 42 | + }, |
| 43 | + plugins: { |
| 44 | + unicorn: unicornPlugin, |
| 45 | + header: headerPlugin, |
| 46 | + prettier: prettierPlugin, |
| 47 | + }, |
| 48 | + rules: { |
| 49 | + 'prettier/prettier': 'error', |
| 50 | + '@typescript-eslint/explicit-function-return-type': 'off', |
| 51 | + '@typescript-eslint/no-use-before-define': 'off', |
| 52 | + '@typescript-eslint/interface-name-prefix': 'off', |
| 53 | + curly: 'error', |
| 54 | + eqeqeq: 'error', |
| 55 | + 'no-return-await': 'error', |
| 56 | + 'require-await': 'error', |
| 57 | + 'header/header': [ |
| 58 | + 'error', |
| 59 | + 'line', |
| 60 | + [' Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.', ' SPDX-License-Identifier: Apache-2.0'], |
| 61 | + ], |
| 62 | + }, |
| 63 | + }, |
| 64 | + { |
| 65 | + files: ['**/*.ts'], |
| 66 | + rules: { |
| 67 | + 'no-dupe-class-members': 'off', |
| 68 | + }, |
| 69 | + }, |
| 70 | + { |
| 71 | + files: ['**/*.js', '**/*.test.ts', '**/test/**/*.ts', 'src/converter/**/*.ts'], |
| 72 | + rules: { |
| 73 | + '@typescript-eslint/no-require-imports': 'off', |
| 74 | + '@typescript-eslint/no-var-requires': 'off', |
| 75 | + '@typescript-eslint/no-explicit-any': 'off', |
| 76 | + '@typescript-eslint/no-unused-expressions': 'off', |
| 77 | + }, |
| 78 | + }, |
| 79 | + { |
| 80 | + files: ['packages/converter/test/inputs/**/*.ts'], |
| 81 | + rules: { |
| 82 | + '@typescript-eslint/explicit-function-return-type': 'error', |
| 83 | + }, |
| 84 | + }, |
| 85 | +]; |
0 commit comments