Skip to content

Commit

Permalink
add test to verify that "no-reaching/allow" can limit the depth of ma…
Browse files Browse the repository at this point in the history
…tches
  • Loading branch information
spalger committed Aug 23, 2016
1 parent f872281 commit d0ce3a8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docs/rules/no-reaching-inside.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ The following patterns are considered problems:
* in my-project/entry.js
*/

import { settings } from './app/index'; // Reaching into "./app" is not allowed
import userReducer from './reducer/user'; // Reaching into "./reducer" is not allowed
import configureStore from './redux/configureStore'; // Reaching into "./redux" is not allowed
import { settings } from './app/index'; // Reaching to "./app/index" is not allowed
import userReducer from './reducer/user'; // Reaching to "./reducer/user" is not allowed
import configureStore from './redux/configureStore'; // Reaching to "./redux/configureStore" is not allowed
```

The following patterns are NOT considered problems:
Expand Down
12 changes: 12 additions & 0 deletions tests/src/rules/no-reaching-inside.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,18 @@ ruleTester.run('no-reaching-inside', rule, {
],

invalid: [
test({
code: 'import "./plugin2/index.js";\nimport "./plugin2/app/index"',
filename: testFilePath('./reaching-inside/plugins/plugin.js'),
options: [ {
allow: [ '*/index.js' ],
} ],
errors: [ {
message: 'Reaching to "./plugin2/app/index" is not allowed.',
line: 2,
column: 8,
} ],
}),
test({
code: 'import "./app/index.js"',
filename: testFilePath('./reaching-inside/plugins/plugin2/internal.js'),
Expand Down

0 comments on commit d0ce3a8

Please sign in to comment.