Skip to content

Commit

Permalink
Use import/extensions eslint plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolo-ribaudo committed Feb 5, 2021
1 parent bbf3493 commit 771d06d
Show file tree
Hide file tree
Showing 15 changed files with 18 additions and 18 deletions.
2 changes: 2 additions & 0 deletions .eslintrc.cjs
Expand Up @@ -43,6 +43,7 @@ module.exports = {
"@babel/development/no-undefined-identifier": "error",
"@babel/development/no-deprecated-clone": "error",
"guard-for-in": "error",
"import/extensions": ["error", { json: "always", cjs: "always" }],
},
globals: { PACKAGE_JSON: "readonly" },
},
Expand All @@ -64,6 +65,7 @@ module.exports = {
"jest/no-standalone-expect": "off",
"jest/no-test-callback": "off",
"jest/valid-describe": "off",
"import/extensions": ["error", { json: "always", cjs: "always" }],
},
},
{
Expand Down
@@ -1,5 +1,5 @@
import * as t from "@babel/types";
import { willPathCastToBoolean } from "./util.js";
import { willPathCastToBoolean } from "./util";

class AssignmentMemoiser {
constructor() {
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-helper-validator-option/src/validator.ts
@@ -1,4 +1,4 @@
import { findSuggestion } from "./find-suggestion.js";
import { findSuggestion } from "./find-suggestion";

export class OptionValidator {
declare descriptor: string;
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-parser/src/parser/error.js
Expand Up @@ -18,7 +18,7 @@ type ErrorContext = {

export type ParsingError = SyntaxError & ErrorContext;

export { ErrorMessages as Errors } from "./error-message.js";
export { ErrorMessages as Errors } from "./error-message";

export default class ParserError extends CommentsParser {
// Forward-declaration: defined in tokenizer/index.js
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-parser/src/parser/expression.js
Expand Up @@ -53,7 +53,7 @@ import {
newArrowHeadScope,
newAsyncArrowScope,
newExpressionScope,
} from "../util/expression-scope.js";
} from "../util/expression-scope";
import { Errors } from "./error";

export default class ExpressionParser extends LValParser {
Expand Down
@@ -1,5 +1,5 @@
import * as babel from "@babel/core";
import proposalClassStaticBlock from "../lib/index.js";
import proposalClassStaticBlock from "..";

describe("plugin ordering", () => {
it("should throw when @babel/plugin-proposal-class-static-block is after class features plugin", () => {
Expand Down
Expand Up @@ -5,10 +5,7 @@ import {
} from "@babel/helper-skip-transparent-expression-wrappers";
import syntaxOptionalChaining from "@babel/plugin-syntax-optional-chaining";
import { types as t, template } from "@babel/core";
import {
willPathCastToBoolean,
findOutermostTransparentParent,
} from "./util.js";
import { willPathCastToBoolean, findOutermostTransparentParent } from "./util";

const { ast } = template.expression;

Expand Down
@@ -1,3 +1,3 @@
/* eslint-disable @babel/development/plugin-name */

export { default } from "@babel/plugin-transform-react-jsx/lib/development.js";
export { default } from "@babel/plugin-transform-react-jsx/lib/development";
@@ -1,4 +1,4 @@
import createPlugin from "./create-plugin.js";
import createPlugin from "./create-plugin";

export default createPlugin({
name: "transform-react-jsx/development",
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-plugin-transform-react-jsx/src/index.js
@@ -1,6 +1,6 @@
/* eslint-disable @babel/development/plugin-name */

import createPlugin from "./create-plugin.js";
import createPlugin from "./create-plugin";

export default createPlugin({
name: "transform-react-jsx",
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-preset-env/src/normalize-options.js
@@ -1,5 +1,5 @@
// @flow
import corejs3Polyfills from "core-js-compat/data";
import corejs3Polyfills from "core-js-compat/data.json";
import { coerce, SemVer } from "semver";
import corejs2Polyfills from "@babel/compat-data/corejs2-built-ins";
import { plugins as pluginsList } from "./plugins-compat-data";
Expand Down
@@ -1,7 +1,7 @@
// @flow

import corejs3Polyfills from "core-js-compat/data";
import corejsEntries from "core-js-compat/entries";
import corejs3Polyfills from "core-js-compat/data.json";
import corejsEntries from "core-js-compat/entries.json";
import getModulesListForTargetVersion from "core-js-compat/get-modules-list-for-target-version";
import { filterItems } from "@babel/helper-compilation-targets";
import {
Expand Down
@@ -1,6 +1,6 @@
// @flow

import corejs3Polyfills from "core-js-compat/data";
import corejs3Polyfills from "core-js-compat/data.json";
import corejs3ShippedProposalsList from "@babel/compat-data/corejs3-shipped-proposals";
import getModulesListForTargetVersion from "core-js-compat/get-modules-list-for-target-version";
import { filterItems } from "@babel/helper-compilation-targets";
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-preset-typescript/src/index.js
@@ -1,6 +1,6 @@
import { declare } from "@babel/helper-plugin-utils";
import transformTypeScript from "@babel/plugin-transform-typescript";
import normalizeOptions from "./normalize-options.js";
import normalizeOptions from "./normalize-options";

export default declare((api, opts) => {
api.assertVersion(7);
Expand Down
3 changes: 2 additions & 1 deletion scripts/rollup-plugin-babel-source.js
Expand Up @@ -88,13 +88,14 @@ export default function () {
? packageJson["browser"]
: packageJson["main"];

const asJS = path.normalize(
let asJS = path.normalize(
path.join(
packageFolder,
// replace lib with src in the package.json entry
filename.replace(/^(\.\/)?lib\//, "src/")
)
);
if (!/\.[a-z]+$/.test(asJS)) asJS += ".js";
const asTS = asJS.replace(/\.js$/, ".ts");

try {
Expand Down

0 comments on commit 771d06d

Please sign in to comment.