Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: clarify .babelignore file loading #2854

Merged
merged 1 commit into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions docs/core.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ All transformations will use your local [configuration files](config-files.md).

## transform

> babel.transform(code: string, [options?](#options): Object, callback: Function)
> babel.transform(code: string, [options?](options.md): Object, callback: Function)

Transforms the passed in `code`. Calling a callback with an object with the generated code,
source map, and AST.
Expand All @@ -40,7 +40,7 @@ In Babel 6, this method was synchronous and `transformSync` did not exist. For b

## transformSync

> babel.transformSync(code: string, [options?](#options): Object)
> babel.transformSync(code: string, [options?](options.md): Object)

Transforms the passed in `code`. Returning an object with the generated code,
source map, and AST.
Expand All @@ -60,7 +60,7 @@ result.ast;

## transformAsync

> babel.transformAsync(code: string, [options?](#options): Object)
> babel.transformAsync(code: string, [options?](options.md): Object)

Transforms the passed in `code`. Returning an promise for an object with the
generated code, source map, and AST.
Expand All @@ -81,7 +81,7 @@ babel.transformAsync("code();", options).then(result => {

## transformFile

> babel.transformFile(filename: string, [options?](#options): Object, callback: Function)
> babel.transformFile(filename: string, [options?](options.md): Object, callback: Function)

Asynchronously transforms the entire contents of a file.

Expand All @@ -99,7 +99,7 @@ babel.transformFile("filename.js", options, function(err, result) {

## transformFileSync

> babel.transformFileSync(filename: string, [options?](#options): Object)
> babel.transformFileSync(filename: string, [options?](options.md): Object)

Synchronous version of `babel.transformFile`. Returns the transformed contents of
the `filename`.
Expand All @@ -116,7 +116,7 @@ babel.transformFileSync("filename.js", options).code;

## transformFileAsync

> babel.transformFileAsync(filename: string, [options?](#options): Object)
> babel.transformFileAsync(filename: string, [options?](options.md): Object)

Promise version of `babel.transformFile`. Returns a promise for the transformed
contents of the `filename`.
Expand All @@ -135,7 +135,7 @@ babel.transformFileAsync("filename.js", options).then(result => {

## transformFromAst

> babel.transformFromAst(ast: Object, code?: string, [options?](#options): Object, callback: Function): FileNode | null
> babel.transformFromAst(ast: Object, code?: string, [options?](options.md): Object, callback: Function): FileNode | null

Given an [AST](https://astexplorer.net/), transform it.

Expand All @@ -155,7 +155,7 @@ In Babel 6, this method was synchronous and `transformFromAstSync` did not exist

## transformFromAstSync

> babel.transformFromAstSync(ast: Object, code?: string, [options?](#options): Object)
> babel.transformFromAstSync(ast: Object, code?: string, [options?](options.md): Object)

Given an [AST](https://astexplorer.net/), transform it.

Expand All @@ -173,7 +173,7 @@ const { code, map, ast } = babel.transformFromAstSync(

## transformFromAstAsync

> babel.transformFromAstAsync(ast: Object, code?: string, [options?](#options): Object)
> babel.transformFromAstAsync(ast: Object, code?: string, [options?](options.md): Object)

Given an [AST](https://astexplorer.net/), transform it.

Expand All @@ -191,7 +191,7 @@ babel

## parse

> babel.parse(code: string, [options?](#options): Object, callback: Function)
> babel.parse(code: string, [options?](options.md): Object, callback: Function)

Given some code, parse it using Babel's standard behavior. Referenced presets and
plugins will be loaded such that optional syntax plugins are automatically
Expand All @@ -207,7 +207,7 @@ will be dropped in Babel 8.

## parseSync

> babel.parseSync(code: string, [options?](#options): Object)
> babel.parseSync(code: string, [options?](options.md): Object)

Returns an AST.

Expand All @@ -217,7 +217,7 @@ enabled.

## parseAsync

> babel.parseAsync(code: string, [options?](#options): Object)
> babel.parseAsync(code: string, [options?](options.md): Object)

Returns a promise for an AST.

Expand All @@ -233,7 +233,7 @@ that aid in loading the configuration part-way without transforming.

### loadOptions

> babel.loadOptions([options?](#options): Object)
> babel.loadOptions([options?](options.md): Object)

Resolve Babel's options fully, resulting in an options object where:

Expand All @@ -250,14 +250,14 @@ invalidate properly, but it is the best we have at the moment.

### loadPartialConfig

> babel.loadPartialConfig([options?](#options): Object): PartialConfig
> babel.loadPartialConfig([options?](options.md): Object): PartialConfig

To allow systems to easily manipulate and validate a user's config, this function
resolves the plugins and presets and proceeds no further. The expectation is
that callers will take the config's `.options`, manipulate it as they see fit
and pass it back to Babel again.

This function accepts one additional option as part of the options object in addition to the standard [options](#options): `showIgnoredFiles`.
This function accepts one additional option as part of the options object in addition to the standard [options](options.md): `showIgnoredFiles`.
When set to true, `loadPartialConfig` always returns a result when a file is ignored, rather than `null`.
This is useful in order to allow the caller to access the list of files that influenced this outcome, e.g.
for watch mode. The caller can determine whether a file was ignored based on the returned `fileHandling` property.
Expand Down
4 changes: 2 additions & 2 deletions docs/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,8 @@ Type: `boolean`<br />
Default: `true` as long as the `filename` option has been specified<br />
Placement: Allowed in Babel's programmatic options, or inside of the loaded [`"configFile"`](#configfile). A programmatic option will override a config file one.<br />

`true` will enable searching for [configuration files](config-files.md#file-relative-configuration) relative
to the [`"filename"`](#filename) provided to Babel.
`true` will enable searching for [configuration files](config-files.md#file-relative-configuration)
and the legacy `.babelignore` file relative to the [`"filename"`](#filename) provided to Babel.

A `babelrc` value passed in the programmatic options will override one set
within a configuration file.
Expand Down