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

CLOUDP-288860: Require .js extension on imports #322

Merged
merged 1 commit into from
Dec 19, 2024
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
15 changes: 15 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
import { fileURLToPath } from 'node:url';
import * as path from 'node:path';
import globals from 'globals';
import { FlatCompat } from '@eslint/eslintrc';
import pluginJs from '@eslint/js';
import pluginJest from 'eslint-plugin-jest';
import jest from 'eslint-plugin-jest';

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

const compat = new FlatCompat({
baseDirectory: __dirname,
});

/** @type {import('eslint').Linter.Config[]} */
export default [
{
Expand All @@ -23,4 +33,9 @@ export default [
files: ['**/*.test.js'],
...jest.configs['flat/recommended'],
},
...compat.config({
plugins: ['require-extensions'],
extends: 'plugin:require-extensions/recommended',
ignorePatterns: ['**/*.test.js'],
}),
];
14 changes: 14 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"@eslint/js": "^9.16.0",
"@jest/globals": "^29.7.0",
"eslint": "^9.17.0",
"eslint-plugin-require-extensions": "^0.1.3",
"globals": "^15.13.0",
"jest": "^29.7.0",
"prettier": "3.4.2"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { isPathParam } from './utils/pathUtils.js';
import { hasException } from './utils/exceptions';
import { hasException } from './utils/exceptions.js';

const RULE_NAME = 'xgen-IPA-102-path-alternate-resource-name-path-param';
const ERROR_MESSAGE = 'API paths must alternate between resource name and path params.';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
isSingletonResource,
getResourcePaths,
} from './utils/resourceEvaluation.js';
import { hasException } from './utils/exceptions';
import { hasException } from './utils/exceptions.js';

const RULE_NAME = 'xgen-IPA-104-resource-has-GET';
const ERROR_MESSAGE = 'APIs must provide a get method for resources.';
Expand Down
Loading