File tree 4 files changed +13
-3
lines changed
4 files changed +13
-3
lines changed Original file line number Diff line number Diff line change
1
+ /**
2
+ * @param {import('eslint').Rule.RuleContext } context
3
+ * @returns 'module' | 'script' | undefined
4
+ */
5
+ export default function sourceType ( context ) {
6
+ return context . parserOptions . sourceType ;
7
+ }
Original file line number Diff line number Diff line change 1
1
import { getSourceCode } from 'eslint-module-utils/contextCompat' ;
2
2
3
3
import docsUrl from '../docsUrl' ;
4
+ import sourceType from '../core/sourceType' ;
4
5
5
6
module . exports = {
6
7
meta : {
@@ -15,7 +16,7 @@ module.exports = {
15
16
16
17
create ( context ) {
17
18
// ignore non-modules
18
- if ( context . parserOptions . sourceType !== 'module' ) {
19
+ if ( sourceType ( context ) !== 'module' ) {
19
20
return { } ;
20
21
}
21
22
Original file line number Diff line number Diff line change
1
+ import sourceType from '../core/sourceType' ;
1
2
import docsUrl from '../docsUrl' ;
2
3
3
4
module . exports = {
@@ -13,7 +14,7 @@ module.exports = {
13
14
14
15
create ( context ) {
15
16
// ignore non-modules
16
- if ( context . parserOptions . sourceType !== 'module' ) {
17
+ if ( sourceType ( context ) !== 'module' ) {
17
18
return { } ;
18
19
}
19
20
Original file line number Diff line number Diff line change 5
5
6
6
import { isModule } from 'eslint-module-utils/unambiguous' ;
7
7
import docsUrl from '../docsUrl' ;
8
+ import sourceType from '../core/sourceType' ;
8
9
9
10
module . exports = {
10
11
meta : {
@@ -19,7 +20,7 @@ module.exports = {
19
20
20
21
create ( context ) {
21
22
// ignore non-modules
22
- if ( context . parserOptions . sourceType !== 'module' ) {
23
+ if ( sourceType ( context ) !== 'module' ) {
23
24
return { } ;
24
25
}
25
26
You can’t perform that action at this time.
0 commit comments