Skip to content

Commit

Permalink
indent lists by one
Browse files Browse the repository at this point in the history
  • Loading branch information
bmish committed Aug 8, 2023
1 parent 57a9fb0 commit 2e2d450
Show file tree
Hide file tree
Showing 28 changed files with 106 additions and 102 deletions.
4 changes: 4 additions & 0 deletions .markdownlint.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@
"line-length": false,
"ul-style": {
"style": "dash"
},
"ul-indent": {
"start_indented": true,
"start_indent": 1
}
}
20 changes: 10 additions & 10 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,26 @@ Thanks for your interest in helping out! Here are a **few** _weird_ tricks to ~~

When opening an [issue](#issues):

- [ ] search open/closed issues
- [ ] discuss bug/enhancement in new or old issue
- [ ] search open/closed issues
- [ ] discuss bug/enhancement in new or old issue

[PR](#prs) time:

- [ ] write tests
- [ ] implement feature/fix bug
- [ ] update docs
- [ ] make a note in change log
- [ ] write tests
- [ ] implement feature/fix bug
- [ ] update docs
- [ ] make a note in change log

Remember, you don't need to do it all yourself; any of these are helpful! 😎

## How to get started

If you are new to `eslint`, below are a few resources that will help you to familiarize yourself with the project.

- Watch [this presentation](https://www.youtube.com/watch?v=2W9tUnALrLg) to learn the fundamental concept of Abstract Syntax Trees (AST) and the way `eslint` works under the hood.
- Familiarize yourself with the [AST explorer](https://astexplorer.net/) tool. Look into rules in `docs/rules`, create patterns in the rules, then analyze its AST.
- Explore the blog posts on how to create a custom rule. [One blog post](https://blog.yonatan.dev/writing-a-custom-eslint-rule-to-spot-undeclared-props/). [Second blog post](https://betterprogramming.pub/creating-custom-eslint-rules-cdc579694608).
- Read the official `eslint` [developer guide](https://eslint.org/docs/latest/developer-guide/architecture/).
- Watch [this presentation](https://www.youtube.com/watch?v=2W9tUnALrLg) to learn the fundamental concept of Abstract Syntax Trees (AST) and the way `eslint` works under the hood.
- Familiarize yourself with the [AST explorer](https://astexplorer.net/) tool. Look into rules in `docs/rules`, create patterns in the rules, then analyze its AST.
- Explore the blog posts on how to create a custom rule. [One blog post](https://blog.yonatan.dev/writing-a-custom-eslint-rule-to-spot-undeclared-props/). [Second blog post](https://betterprogramming.pub/creating-custom-eslint-rules-cdc579694608).
- Read the official `eslint` [developer guide](https://eslint.org/docs/latest/developer-guide/architecture/).

## Issues

Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ resolvers are just npm packages, so [third party packages are supported](https:/

You can reference resolvers in several ways (in order of precedence):

- as a conventional `eslint-import-resolver` name, like `eslint-import-resolver-foo`:
- as a conventional `eslint-import-resolver` name, like `eslint-import-resolver-foo`:

```yaml
# .eslintrc.yml
Expand All @@ -195,7 +195,7 @@ module.exports = {
}
```

- with a full npm module name, like `my-awesome-npm-module`:
- with a full npm module name, like `my-awesome-npm-module`:

```yaml
# .eslintrc.yml
Expand All @@ -214,7 +214,7 @@ module.exports = {
}
```

- with a filesystem path to resolver, defined in this example as a `computed property` name:
- with a filesystem path to resolver, defined in this example as a `computed property` name:

```js
// .eslintrc.js
Expand Down Expand Up @@ -336,11 +336,11 @@ If you are using `yarn` PnP as your package manager, add the `.yarn` folder and

Each item in this array is either a folder's name, its subpath, or its absolute prefix path:

- `jspm_modules` will match any file or folder named `jspm_modules` or which has a direct or non-direct parent named `jspm_modules`, e.g. `/home/me/project/jspm_modules` or `/home/me/project/jspm_modules/some-pkg/index.js`.
- `jspm_modules` will match any file or folder named `jspm_modules` or which has a direct or non-direct parent named `jspm_modules`, e.g. `/home/me/project/jspm_modules` or `/home/me/project/jspm_modules/some-pkg/index.js`.

- `packages/core` will match any path that contains these two segments, for example `/home/me/project/packages/core/src/utils.js`.
- `packages/core` will match any path that contains these two segments, for example `/home/me/project/packages/core/src/utils.js`.

- `/home/me/project/packages` will only match files and directories inside this directory, and the directory itself.
- `/home/me/project/packages` will only match files and directories inside this directory, and the directory itself.

Please note that incomplete names are not allowed here so `components` won't match `bower_components` and `packages/ui` won't match `packages/ui-utils` (but will match `packages/ui/utils`).

Expand Down
4 changes: 2 additions & 2 deletions docs/rules/consistent-type-specifier-style.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ This rule includes a fixer that will automatically convert your specifiers to th

The rule accepts a single string option which may be one of:

- `'prefer-inline'` - enforces that named type-only specifiers are only ever written with an inline marker; and never as part of a top-level, type-only import.
- `'prefer-top-level'` - enforces that named type-only specifiers only ever written as part of a top-level, type-only import; and never with an inline marker.
- `'prefer-inline'` - enforces that named type-only specifiers are only ever written with an inline marker; and never as part of a top-level, type-only import.
- `'prefer-top-level'` - enforces that named type-only specifiers only ever written as part of a top-level, type-only import; and never with an inline marker.

By default the rule will use the `prefer-inline` option.

Expand Down
6 changes: 3 additions & 3 deletions docs/rules/default.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ either, so such a situation will be reported in the importing module.

## Further Reading

- Lee Byron's [ES7] export proposal
- [`import/ignore`] setting
- [`jsnext:main`] (Rollup)
- Lee Byron's [ES7] export proposal
- [`import/ignore`] setting
- [`jsnext:main`] (Rollup)

[ES7]: https://github.com/leebyron/ecmascript-more-export-from
[`import/ignore`]: ../../README.md#importignore
Expand Down
2 changes: 1 addition & 1 deletion docs/rules/export.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ intent to rename, etc.

## Further Reading

- Lee Byron's [ES7] export proposal
- Lee Byron's [ES7] export proposal

[ES7]: https://github.com/leebyron/ecmascript-more-export-from
4 changes: 2 additions & 2 deletions docs/rules/first.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ enable this rule.

## Further Reading

- [`import/order`]: a major step up from `absolute-first`
- Issue [#255]
- [`import/order`]: a major step up from `absolute-first`
- Issue [#255]

[`import/order`]: ./order.md
[#255]: https://github.com/import-js/eslint-plugin-import/issues/255
6 changes: 3 additions & 3 deletions docs/rules/named.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ runtime, you will likely see false positives with this rule.

## Further Reading

- [`import/ignore`] setting
- [`jsnext:main`] deprecation
- [`pkg.module`] (Rollup)
- [`import/ignore`] setting
- [`jsnext:main`] deprecation
- [`pkg.module`] (Rollup)

[`jsnext:main`]: https://github.com/jsforum/jsforum/issues/5
[`pkg.module`]: https://github.com/rollup/rollup/wiki/pkg.module
Expand Down
6 changes: 3 additions & 3 deletions docs/rules/namespace.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ still can't be statically analyzed any further.

## Further Reading

- Lee Byron's [ES7] export proposal
- [`import/ignore`] setting
- [`jsnext:main`](Rollup)
- Lee Byron's [ES7] export proposal
- [`import/ignore`] setting
- [`jsnext:main`](Rollup)

[ES7]: https://github.com/leebyron/ecmascript-more-export-from
[`import/ignore`]: ../../README.md#importignore
Expand Down
4 changes: 2 additions & 2 deletions docs/rules/newline-after-import.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ Enforces having one or more empty lines after the last top-level import statemen

This rule supports the following options:

- `count` which sets the number of newlines that are enforced after the last top-level import statement or require call. This option defaults to `1`.
- `count` which sets the number of newlines that are enforced after the last top-level import statement or require call. This option defaults to `1`.

- `considerComments` which enforces the rule on comments after the last import-statement as well when set to true. This option defaults to `false`.
- `considerComments` which enforces the rule on comments after the last import-statement as well when set to true. This option defaults to `false`.

Valid:

Expand Down
6 changes: 3 additions & 3 deletions docs/rules/no-absolute-path.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ By default, only ES6 imports and CommonJS `require` calls will have this rule en

You may provide an options object providing true/false for any of

- `esmodule`: defaults to `true`
- `commonjs`: defaults to `true`
- `amd`: defaults to `false`
- `esmodule`: defaults to `true`
- `commonjs`: defaults to `true`
- `amd`: defaults to `false`

If `{ amd: true }` is provided, dependency paths for AMD-style `define` and `require`
calls will be resolved:
Expand Down
4 changes: 2 additions & 2 deletions docs/rules/no-amd.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ Special thanks to @xjamundx for donating his no-define rule as a start to this.

## Further Reading

- [`no-commonjs`](./no-commonjs.md): report CommonJS `require` and `exports`
- Source: <https://github.com/xjamundx/eslint-plugin-modules>
- [`no-commonjs`](./no-commonjs.md): report CommonJS `require` and `exports`
- Source: <https://github.com/xjamundx/eslint-plugin-modules>
4 changes: 2 additions & 2 deletions docs/rules/no-commonjs.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,5 +92,5 @@ Special thanks to @xjamundx for donating the module.exports and exports.* bits.

## Further Reading

- [`no-amd`](./no-amd.md): report on AMD `require`, `define`
- Source: <https://github.com/xjamundx/eslint-plugin-modules>
- [`no-amd`](./no-amd.md): report on AMD `require`, `define`
- Source: <https://github.com/xjamundx/eslint-plugin-modules>
6 changes: 3 additions & 3 deletions docs/rules/no-cycle.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ this rule enabled.

## Further Reading

- [Original inspiring issue](https://github.com/import-js/eslint-plugin-import/issues/941)
- Rule to detect that module imports itself: [`no-self-import`]
- [`import/external-module-folders`] setting
- [Original inspiring issue](https://github.com/import-js/eslint-plugin-import/issues/941)
- Rule to detect that module imports itself: [`no-self-import`]
- [`import/external-module-folders`] setting

[`no-self-import`]: ./no-self-import.md

Expand Down
14 changes: 7 additions & 7 deletions docs/rules/no-deprecated.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ settings:
## Worklist
- [x] report explicit imports on the import node
- [x] support namespaces
- [x] should bubble up through deep namespaces (#157)
- [x] report explicit imports at reference time (at the identifier) similar to namespace
- [x] mark module deprecated if file JSDoc has a @deprecated tag?
- [ ] don't flag redeclaration of imported, deprecated names
- [ ] flag destructuring
- [x] report explicit imports on the import node
- [x] support namespaces
- [x] should bubble up through deep namespaces (#157)
- [x] report explicit imports at reference time (at the identifier) similar to namespace
- [x] mark module deprecated if file JSDoc has a @deprecated tag?
- [ ] don't flag redeclaration of imported, deprecated names
- [ ] flag destructuring
4 changes: 2 additions & 2 deletions docs/rules/no-import-module-exports.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ If you have multiple entry points or are using `js:next` this rule includes an

### `exceptions`

- An array of globs. The rule will be omitted from any file that matches a glob
- An array of globs. The rule will be omitted from any file that matches a glob
in the options array. For example, the following setting will omit the rule
in the `some-file.js` file.

Expand Down Expand Up @@ -78,4 +78,4 @@ module.exports = foo;

### Further Reading

- [webpack issue #4039](https://github.com/webpack/webpack/issues/4039)
- [webpack issue #4039](https://github.com/webpack/webpack/issues/4039)
4 changes: 2 additions & 2 deletions docs/rules/no-internal-modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ Use this rule to prevent importing the submodules of other modules.

This rule has two mutally exclusive options that are arrays of [minimatch/glob patterns](https://github.com/isaacs/node-glob#glob-primer) patterns:

- `allow` that include paths and import statements that can be imported with reaching.
- `forbid` that exclude paths and import statements that can be imported with reaching.
- `allow` that include paths and import statements that can be imported with reaching.
- `forbid` that exclude paths and import statements that can be imported with reaching.

### Examples

Expand Down
4 changes: 2 additions & 2 deletions docs/rules/no-mutable-exports.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ export function getCount() {} // reported here: exported function is reassigned
To prevent general reassignment of these identifiers, exported or not, you may
want to enable the following core ESLint rules:

- [no-func-assign]
- [no-class-assign]
- [no-func-assign]
- [no-class-assign]

[no-func-assign]: https://eslint.org/docs/rules/no-func-assign
[no-class-assign]: https://eslint.org/docs/rules/no-class-assign
Expand Down
8 changes: 4 additions & 4 deletions docs/rules/no-named-as-default.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ Reports use of an exported name as the locally imported name of a default export

Rationale: using an exported name as the name of the default export is likely...

- _misleading_: others familiar with `foo.js` probably expect the name to be `foo`
- _a mistake_: only needed to import `bar` and forgot the brackets (the case that is prompting this)
- _misleading_: others familiar with `foo.js` probably expect the name to be `foo`
- _a mistake_: only needed to import `bar` and forgot the brackets (the case that is prompting this)

## Rule Details

Expand Down Expand Up @@ -46,8 +46,8 @@ export bar from './foo.js';

## Further Reading

- ECMAScript Proposal: [export ns from]
- ECMAScript Proposal: [export default from]
- ECMAScript Proposal: [export ns from]
- ECMAScript Proposal: [export default from]

[export ns from]: https://github.com/leebyron/ecmascript-export-ns-from
[export default from]: https://github.com/leebyron/ecmascript-export-default-from
2 changes: 1 addition & 1 deletion docs/rules/no-namespace.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The rule is auto-fixable when the namespace object is only used for direct membe

This rule supports the following options:

- `ignore`: array of glob strings for modules that should be ignored by the rule.
- `ignore`: array of glob strings for modules that should be ignored by the rule.

## Rule Details

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-nodejs-modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Forbid the use of Node.js builtin modules. Can be useful for client-side web pro

This rule supports the following options:

- `allow`: Array of names of allowed modules. Defaults to an empty array.
- `allow`: Array of names of allowed modules. Defaults to an empty array.

## Rule Details

Expand Down
26 changes: 13 additions & 13 deletions docs/rules/no-restricted-paths.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@ The default value for `basePath` is the current working directory.

Each zone consists of the `target` paths, a `from` paths, and an optional `except` and `message` attribute.

- `target` contains the paths where the restricted imports should be applied. It can be expressed by
- directory string path that matches all its containing files
- glob pattern matching all the targeted files
- an array of multiple of the two types above
- `from` paths define the folders that are not allowed to be used in an import. It can be expressed by
- directory string path that matches all its containing files
- glob pattern matching all the files restricted to be imported
- an array of multiple directory string path
- an array of multiple glob patterns
- `except` may be defined for a zone, allowing exception paths that would otherwise violate the related `from`. Note that it does not alter the behaviour of `target` in any way.
- in case `from` contains only glob patterns, `except` must be an array of glob patterns as well
- in case `from` contains only directory path, `except` is relative to `from` and cannot backtrack to a parent directory
- `message` - will be displayed in case of the rule violation.
- `target` contains the paths where the restricted imports should be applied. It can be expressed by
- directory string path that matches all its containing files
- glob pattern matching all the targeted files
- an array of multiple of the two types above
- `from` paths define the folders that are not allowed to be used in an import. It can be expressed by
- directory string path that matches all its containing files
- glob pattern matching all the files restricted to be imported
- an array of multiple directory string path
- an array of multiple glob patterns
- `except` may be defined for a zone, allowing exception paths that would otherwise violate the related `from`. Note that it does not alter the behaviour of `target` in any way.
- in case `from` contains only glob patterns, `except` must be an array of glob patterns as well
- in case `from` contains only directory path, `except` is relative to `from` and cannot backtrack to a parent directory
- `message` - will be displayed in case of the rule violation.

### Examples

Expand Down
4 changes: 2 additions & 2 deletions docs/rules/no-unassigned-import.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

With both CommonJS' `require` and the ES6 modules' `import` syntax, it is possible to import a module but not to use its result. This can be done explicitly by not assigning the module to as variable. Doing so can mean either of the following things:

- The module is imported but not used
- The module has side-effects (like [`should`](https://www.npmjs.com/package/should)). Having side-effects, makes it hard to know whether the module is actually used or can be removed. It can also make it harder to test or mock parts of your application.
- The module is imported but not used
- The module has side-effects (like [`should`](https://www.npmjs.com/package/should)). Having side-effects, makes it hard to know whether the module is actually used or can be removed. It can also make it harder to test or mock parts of your application.

This rule aims to remove modules with side-effects by reporting when a module is imported but not assigned.

Expand Down
8 changes: 4 additions & 4 deletions docs/rules/no-unresolved.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ If you're using a module bundler other than Node or Webpack, you may end up with

## Further Reading

- [Resolver plugins](../../README.md#resolvers)
- [Node resolver](https://npmjs.com/package/eslint-import-resolver-node) (default)
- [Webpack resolver](https://npmjs.com/package/eslint-import-resolver-webpack)
- [`import/ignore`] global setting
- [Resolver plugins](../../README.md#resolvers)
- [Node resolver](https://npmjs.com/package/eslint-import-resolver-node) (default)
- [Webpack resolver](https://npmjs.com/package/eslint-import-resolver-webpack)
- [`import/ignore`] global setting

[`import/ignore`]: ../../README.md#importignore
14 changes: 7 additions & 7 deletions docs/rules/no-unused-modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

Reports:

- modules without any exports
- individual exports not being statically `import`ed or `require`ed from other modules in the same project
- dynamic imports are supported if argument is a literal string
- modules without any exports
- individual exports not being statically `import`ed or `require`ed from other modules in the same project
- dynamic imports are supported if argument is a literal string

## Rule Details

Expand All @@ -27,10 +27,10 @@ Example:

This rule takes the following option:

- **`missingExports`**: if `true`, files without any exports are reported (defaults to `false`)
- **`unusedExports`**: if `true`, exports without any static usage within other modules are reported (defaults to `false`)
- `src`: an array with files/paths to be analyzed. It only applies to unused exports. Defaults to `process.cwd()`, if not provided
- `ignoreExports`: an array with files/paths for which unused exports will not be reported (e.g module entry points in a published package)
- **`missingExports`**: if `true`, files without any exports are reported (defaults to `false`)
- **`unusedExports`**: if `true`, exports without any static usage within other modules are reported (defaults to `false`)
- `src`: an array with files/paths to be analyzed. It only applies to unused exports. Defaults to `process.cwd()`, if not provided
- `ignoreExports`: an array with files/paths for which unused exports will not be reported (e.g module entry points in a published package)

### Example for missing exports

Expand Down
Loading

0 comments on commit 2e2d450

Please sign in to comment.