2022-07-23 17:15:13 +02:00
const path = require ( 'path' ) ;
const scriptPath = path . join ( _ _dirname , '..' , 'scripts' ) ;
2017-04-14 09:26:27 +02:00
module . exports = {
2017-05-26 14:10:52 +02:00
root : true ,
2022-07-23 17:15:13 +02:00
extends : [ path . join ( scriptPath , '.eslintrc.js' ) ] ,
2022-10-24 13:23:37 +02:00
parserOptions : {
tsconfigRootDir : _ _dirname ,
project : [ './tsconfig.json' ] ,
} ,
2023-08-07 17:09:43 +02:00
plugins : [ 'local-rules' ] ,
2022-10-24 14:57:37 +02:00
rules : {
'eslint-comments/disable-enable-pair' : [ 'error' , { allowWholeFile : true } ] ,
2022-12-29 14:58:01 -05:00
'eslint-comments/no-unused-disable' : 'error' ,
2022-10-24 14:57:37 +02:00
'react-hooks/rules-of-hooks' : 'off' ,
2022-12-29 22:57:53 -05:00
'import/extensions' : 'off' , // for mjs, we sometimes need extensions
2022-10-24 14:57:37 +02:00
'jest/no-done-callback' : 'off' ,
2022-11-24 15:26:31 +01:00
'@typescript-eslint/dot-notation' : [
'error' ,
{
allowIndexSignaturePropertyAccess : true ,
} ,
] ,
2022-10-24 14:57:37 +02:00
} ,
2018-02-17 22:33:31 +03:00
overrides : [
2022-10-24 14:57:37 +02:00
{
// this package depends on a lot of peerDependencies we don't want to specify, because npm would install them
files : [ '**/frameworks/angular/template/**/*' ] ,
rules : {
'@typescript-eslint/no-useless-constructor' : 'off' ,
2022-10-26 10:28:23 +02:00
'@typescript-eslint/dot-notation' : 'off' ,
2022-10-24 14:57:37 +02:00
} ,
} ,
2022-02-11 16:01:20 +01:00
{
// this package depends on a lot of peerDependencies we don't want to specify, because npm would install them
files : [ '**/addons/docs/**/*' ] ,
rules : {
'import/no-extraneous-dependencies' : 'off' ,
} ,
} ,
2022-10-24 13:23:37 +02:00
{
2022-10-24 14:57:37 +02:00
files : [
'*.js' ,
'*.jsx' ,
'*.json' ,
'*.html' ,
'**/.storybook/*.ts' ,
'**/.storybook/*.tsx' ,
'setup-jest.ts' ,
] ,
2022-10-24 13:23:37 +02:00
parserOptions : {
project : null ,
} ,
rules : {
// '@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/dot-notation' : 'off' ,
'@typescript-eslint/no-implied-eval' : 'off' ,
'@typescript-eslint/no-throw-literal' : 'off' ,
'@typescript-eslint/return-await' : 'off' ,
} ,
} ,
2022-04-25 15:22:02 +02:00
{
// this package depends on a lot of peerDependencies we don't want to specify, because npm would install them
files : [ '**/*.ts' , '**/*.tsx' ] ,
rules : {
'no-shadow' : 'off' ,
'@typescript-eslint/ban-types' : 'warn' , // should become error, in the future
} ,
} ,
2022-01-28 15:27:20 +01:00
{
2022-12-29 15:34:17 -05:00
// these packages use pre-bundling, dependencies will be bundled, and will be in devDepenencies
2023-05-24 16:08:39 +02:00
files : [
'addons/**/*' ,
'frameworks/**/*' ,
'lib/**/*' ,
'builders/**/*' ,
2023-05-24 16:51:20 +02:00
'deprecated/**/*' ,
2023-05-24 16:08:39 +02:00
'renderers/**/*' ,
'ui/**/*' ,
] ,
2022-12-29 15:34:17 -05:00
excludedFiles : [ 'frameworks/angular/**/*' , 'frameworks/ember/**/*' , 'lib/core-server/**/*' ] ,
2022-01-28 15:27:20 +01:00
rules : {
2022-12-29 15:34:17 -05:00
'import/no-extraneous-dependencies' : [
'error' ,
{ bundledDependencies : false , devDependencies : true } ,
] ,
2022-01-28 15:27:20 +01:00
} ,
} ,
2022-10-13 01:38:11 +02:00
{
2022-10-13 13:24:35 +02:00
files : [ '**/ui/*' , '**/ui/.storybook/*' ] ,
2022-10-13 01:38:11 +02:00
rules : {
'import/no-extraneous-dependencies' : [ 'error' , { packageDir : _ _dirname } ] ,
} ,
} ,
2018-11-19 17:21:53 +01:00
{
2023-09-14 15:19:49 +02:00
files : [ '**/__tests__/**' , '**/__testfixtures__/**' , '**/*.test.*' , '**/*.stories.*' ] ,
2018-11-19 17:21:53 +01:00
rules : {
2019-11-15 15:37:14 +02:00
'@typescript-eslint/no-empty-function' : 'off' ,
'import/no-extraneous-dependencies' : 'off' ,
2018-11-19 17:21:53 +01:00
} ,
} ,
2020-04-10 07:49:54 +08:00
{
files : [ '**/__testfixtures__/**' ] ,
rules : {
'react/forbid-prop-types' : 'off' ,
'react/no-unused-prop-types' : 'off' ,
'react/require-default-props' : 'off' ,
} ,
} ,
2019-11-15 15:37:14 +02:00
{ files : '**/.storybook/config.js' , rules : { 'global-require' : 'off' } } ,
2019-04-25 17:59:37 +02:00
{
files : [ '**/*.stories.*' ] ,
rules : {
2019-11-15 15:37:14 +02:00
'no-console' : 'off' ,
2019-04-25 17:59:37 +02:00
} ,
} ,
{
files : [ '**/*.tsx' , '**/*.ts' ] ,
rules : {
2020-11-26 16:55:47 +01:00
'react/require-default-props' : 'off' ,
2019-11-15 15:37:14 +02:00
'react/prop-types' : 'off' , // we should use types
2020-11-26 16:55:47 +01:00
'react/forbid-prop-types' : 'off' , // we should use types
2019-11-15 15:37:14 +02:00
'no-dupe-class-members' : 'off' , // this is called overloads in typescript
2022-01-19 13:54:39 +01:00
'react/no-unused-prop-types' : 'off' , // we should use types
'react/default-props-match-prop-types' : 'off' , // we should use types
'import/no-named-as-default' : 'warn' ,
'import/no-named-as-default-member' : 'warn' ,
'react/destructuring-assignment' : 'warn' ,
// This warns about importing interfaces and types in a normal import, it's arguably better to import with the `type` prefix separate from the runtime imports,
// I leave this as a warning right now because we haven't really decided yet, and the codebase is riddled with errors if I set to 'error'.
// It IS set to 'error' for JS files.
'import/named' : 'warn' ,
2019-04-25 17:59:37 +02:00
} ,
} ,
2019-04-25 23:59:40 +02:00
{
files : [ '**/*.d.ts' ] ,
rules : {
2019-11-15 15:37:14 +02:00
'vars-on-top' : 'off' ,
'no-var' : 'off' , // this is how typescript works
'spaced-comment' : 'off' ,
2019-04-25 23:59:40 +02:00
} ,
} ,
2022-08-01 11:54:32 +10:00
{
files : [ '**/e2e-tests/**/*' ] ,
rules : {
'jest/no-test-callback' : 'off' , // These aren't jest tests
} ,
} ,
2022-08-22 22:25:20 +08:00
{
files : [ '**/builder-vite/input/iframe.html' ] ,
rules : {
'no-undef' : 'off' , // ignore "window" undef errors
} ,
} ,
2022-10-12 11:36:26 +02:00
{
// Because those templates reference css files in other directory.
files : [ '**/template/cli/**/*' ] ,
rules : {
'import/no-unresolved' : 'off' ,
} ,
} ,
2023-08-09 11:50:43 +02:00
{
files : [ '**/*.ts' , '!**/*.test.*' , '!**/*.spec.*' ] ,
rules : {
'local-rules/no-uncategorized-errors' : 'warn' ,
} ,
} ,
{
files : [ '**/core-events/src/**/*' ] ,
excludedFiles : [ '**/*.test.*' ] ,
rules : {
'local-rules/no-duplicated-error-codes' : 'error' ,
} ,
} ,
2018-02-17 22:33:31 +03:00
] ,
2017-06-06 13:18:33 +02:00
} ;