Skip to content

Commit

Permalink
rename to no-internal-modules
Browse files Browse the repository at this point in the history
  • Loading branch information
spalger committed Sep 12, 2016
1 parent 3d00542 commit 152dd37
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 21 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# no-reaching-inside
# no-internal-modules

Use this rule to prevent importing the submodules of other modules.

Expand Down Expand Up @@ -32,7 +32,7 @@ And the .eslintrc file:
{
...
"rules": {
"import/no-reaching-inside": [ "error", {
"import/no-internal-modules": [ "error", {
"allow": [ "**/actions/*", "source-map-support/*" ]
} ]
}
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const rules = {
'no-mutable-exports': require('./rules/no-mutable-exports'),
'extensions': require('./rules/extensions'),
'no-restricted-paths': require('./rules/no-restricted-paths'),
'no-reaching-inside': require('./rules/no-reaching-inside'),
'no-internal-modules': require('./rules/no-internal-modules'),

'no-named-as-default': require('./rules/no-named-as-default'),
'no-named-as-default-member': require('./rules/no-named-as-default-member'),
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion test-build.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
require('babel-register')
require('./tests/src/rules/no-reaching-inside.js')
require('./tests/src/rules/no-internal-modules.js')
Original file line number Diff line number Diff line change
@@ -1,54 +1,54 @@
import { RuleTester } from 'eslint'
import rule from 'rules/no-reaching-inside'
import rule from 'rules/no-internal-modules'

import { test, testFilePath } from '../utils'

const ruleTester = new RuleTester()

ruleTester.run('no-reaching-inside', rule, {
ruleTester.run('no-internal-modules', rule, {
valid: [
test({
code: 'import a from "./plugin2"',
filename: testFilePath('./reaching-inside/plugins/plugin.js'),
filename: testFilePath('./internal-modules/plugins/plugin.js'),
options: [],
}),
test({
code: 'const a = require("./plugin2")',
filename: testFilePath('./reaching-inside/plugins/plugin.js'),
filename: testFilePath('./internal-modules/plugins/plugin.js'),
}),
test({
code: 'const a = require("./plugin2/")',
filename: testFilePath('./reaching-inside/plugins/plugin.js'),
filename: testFilePath('./internal-modules/plugins/plugin.js'),
}),
test({
code: 'const dynamic = "./plugin2/"; const a = require(dynamic)',
filename: testFilePath('./reaching-inside/plugins/plugin.js'),
filename: testFilePath('./internal-modules/plugins/plugin.js'),
}),
test({
code: 'import b from "./internal.js"',
filename: testFilePath('./reaching-inside/plugins/plugin2/index.js'),
filename: testFilePath('./internal-modules/plugins/plugin2/index.js'),
}),
test({
code: 'import get from "lodash.get"',
filename: testFilePath('./reaching-inside/plugins/plugin2/index.js'),
filename: testFilePath('./internal-modules/plugins/plugin2/index.js'),
}),
test({
code: 'import b from "../../api/service"',
filename: testFilePath('./reaching-inside/plugins/plugin2/internal.js'),
filename: testFilePath('./internal-modules/plugins/plugin2/internal.js'),
options: [ {
allow: [ '**/api/*' ],
} ],
}),
test({
code: 'import "jquery/dist/jquery"',
filename: testFilePath('./reaching-inside/plugins/plugin2/internal.js'),
filename: testFilePath('./internal-modules/plugins/plugin2/internal.js'),
options: [ {
allow: [ 'jquery/dist/*' ],
} ],
}),
test({
code: 'import "./app/index.js";\nimport "./app/index"',
filename: testFilePath('./reaching-inside/plugins/plugin2/internal.js'),
filename: testFilePath('./internal-modules/plugins/plugin2/internal.js'),
options: [ {
allow: [ '**/index{.js,}' ],
} ],
Expand All @@ -58,7 +58,7 @@ ruleTester.run('no-reaching-inside', rule, {
invalid: [
test({
code: 'import "./plugin2/index.js";\nimport "./plugin2/app/index"',
filename: testFilePath('./reaching-inside/plugins/plugin.js'),
filename: testFilePath('./internal-modules/plugins/plugin.js'),
options: [ {
allow: [ '*/index.js' ],
} ],
Expand All @@ -70,7 +70,7 @@ ruleTester.run('no-reaching-inside', rule, {
}),
test({
code: 'import "./app/index.js"',
filename: testFilePath('./reaching-inside/plugins/plugin2/internal.js'),
filename: testFilePath('./internal-modules/plugins/plugin2/internal.js'),
errors: [ {
message: 'Reaching to "./app/index.js" is not allowed.',
line: 1,
Expand All @@ -79,7 +79,7 @@ ruleTester.run('no-reaching-inside', rule, {
}),
test({
code: 'import b from "./plugin2/internal"',
filename: testFilePath('./reaching-inside/plugins/plugin.js'),
filename: testFilePath('./internal-modules/plugins/plugin.js'),
errors: [ {
message: 'Reaching to "./plugin2/internal" is not allowed.',
line: 1,
Expand All @@ -88,9 +88,9 @@ ruleTester.run('no-reaching-inside', rule, {
}),
test({
code: 'import a from "../api/service/index"',
filename: testFilePath('./reaching-inside/plugins/plugin.js'),
filename: testFilePath('./internal-modules/plugins/plugin.js'),
options: [ {
allow: [ '**/reaching-inside/*' ],
allow: [ '**/internal-modules/*' ],
} ],
errors: [
{
Expand All @@ -102,7 +102,7 @@ ruleTester.run('no-reaching-inside', rule, {
}),
test({
code: 'import get from "debug/node"',
filename: testFilePath('./reaching-inside/plugins/plugin.js'),
filename: testFilePath('./internal-modules/plugins/plugin.js'),
errors: [
{
message: 'Reaching to "debug/node" is not allowed.',
Expand Down

0 comments on commit 152dd37

Please sign in to comment.