33// found in the LICENSE file.
44
55/* eslint-disable import/no-default-export */
6+
7+ import stylisticPlugin from '@stylistic/eslint-plugin' ;
68import typescriptPlugin from '@typescript-eslint/eslint-plugin' ;
7- import mochaPlugin from 'eslint-plugin-mocha' ;
8- import rulesdirPlugin from 'eslint-plugin-rulesdir' ;
9+ import tsParser from '@typescript-eslint/parser' ;
910import importPlugin from 'eslint-plugin-import' ;
1011import jsdocPlugin from 'eslint-plugin-jsdoc' ;
12+ import mochaPlugin from 'eslint-plugin-mocha' ;
13+ import rulesdirPlugin from 'eslint-plugin-rulesdir' ;
1114import globals from 'globals' ;
12- import tsParser from '@typescript-eslint/parser' ;
13- import stylisticPlugin from '@stylistic/eslint-plugin' ;
1415import { join } from 'path' ;
1516
1617rulesdirPlugin . RULES_DIR = join (
@@ -259,6 +260,24 @@ export default [
259260 * import * as FooModule from './foo.js'
260261 **/
261262 'import/no-duplicates' : 'error' ,
263+ /**
264+ * Provides more consistency in the imports.
265+ */
266+ 'import/order' : [
267+ 'error' ,
268+ {
269+ // We need to group the builtin and external as clang-format
270+ // can't differentiate the two
271+ groups : [ [ 'builtin' , 'external' ] , 'parent' , 'sibling' , 'index' ] ,
272+ 'newlines-between' : 'always' ,
273+ // clang-format has it's own logic overriding this
274+ named : false ,
275+ alphabetize : {
276+ order : 'asc' ,
277+ caseInsensitive : true ,
278+ } ,
279+ } ,
280+ ] ,
262281 // Try to spot '// console.log()' left over from debugging
263282 'rulesdir/no-commented-out-console' : 'error' ,
264283 // Prevent imports being commented out rather than deleted.
@@ -283,11 +302,11 @@ export default [
283302 parserOptions : {
284303 allowAutomaticSingleRunInference : true ,
285304 project : join (
286- import . meta. dirname ,
287- 'config' ,
288- 'typescript' ,
289- 'tsconfig.eslint.json' ,
290- ) ,
305+ import . meta. dirname ,
306+ 'config' ,
307+ 'typescript' ,
308+ 'tsconfig.eslint.json' ,
309+ ) ,
291310 } ,
292311 } ,
293312
@@ -476,12 +495,12 @@ export default [
476495 {
477496 // Enforce that any import of models/trace/trace.js names the import Trace.
478497 modulePath : join (
479- import . meta. dirname ,
480- 'front_end' ,
481- 'models' ,
482- 'trace' ,
483- 'trace.js' ,
484- ) ,
498+ import . meta. dirname ,
499+ 'front_end' ,
500+ 'models' ,
501+ 'trace' ,
502+ 'trace.js' ,
503+ ) ,
485504 importName : 'Trace' ,
486505 } ,
487506 ] ,
0 commit comments