@@ -12,6 +12,8 @@ import importPlugin from 'eslint-plugin-import';
1212import globals from 'globals' ;
1313import simpleImportSort from 'eslint-plugin-simple-import-sort' ;
1414import { changeRulesToStylistic } from 'eslint-migration-utils' ;
15+ import unicorn from 'eslint-plugin-unicorn' ;
16+ import customRules from './eslint_plugins/index.js' ;
1517
1618const __filename = fileURLToPath ( import . meta. url ) ;
1719const __dirname = path . dirname ( __filename ) ;
@@ -47,6 +49,8 @@ export default [
4749 plugins : {
4850 'no-only-tests' : noOnlyTests ,
4951 i18n : i18N ,
52+ unicorn,
53+ 'devextreme-custom' : customRules ,
5054 } ,
5155 settings : {
5256 'import/resolver' : {
@@ -520,6 +524,51 @@ export default [
520524 '@typescript-eslint/prefer-for-of' : 'warn' ,
521525 } ,
522526 } ,
527+ // Rules for scheduler
528+ {
529+ files : [ 'js/__internal/scheduler/**/*.ts?(x)' ] ,
530+ languageOptions : {
531+ parser : tsParser ,
532+ ecmaVersion : 5 ,
533+ sourceType : 'script' ,
534+ parserOptions : {
535+ project : './tsconfig.json' ,
536+ tsconfigRootDir : `${ __dirname } /js/__internal` ,
537+ } ,
538+ } ,
539+ rules : {
540+ 'no-implicit-coercion' : [ 'error' ] ,
541+ 'no-extra-boolean-cast' : 'error' ,
542+ 'unicorn/filename-case' : [ 'error' , { case : 'snakeCase' } ] ,
543+ '@typescript-eslint/naming-convention' : [
544+ 'error' ,
545+ {
546+ selector : [ 'variable' , 'function' , 'parameter' ] ,
547+ format : null ,
548+ leadingUnderscore : 'forbid' ,
549+ // allow only a single underscore identifier `_` to bypass this rule
550+ filter : {
551+ regex : '^_$' ,
552+ match : false ,
553+ } ,
554+ } ,
555+ {
556+ selector : 'memberLike' ,
557+ format : null ,
558+ leadingUnderscore : 'allow' ,
559+ } ,
560+ ] ,
561+ 'devextreme-custom/no-deferred' : 'error' ,
562+ 'devextreme-custom/prefer-switch-true' : [ 'error' , { minBranches : 3 } ] ,
563+ } ,
564+ } ,
565+ // Allow Deferred in m_* scheduler files only
566+ {
567+ files : [ 'js/__internal/scheduler/**/m_*.ts?(x)' ] ,
568+ rules : {
569+ 'devextreme-custom/no-deferred' : 'off' ,
570+ } ,
571+ } ,
523572 // Rules for grid controls
524573 {
525574 files : [
0 commit comments