Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eslint-module-utils

Package Overview
Dependencies
Maintainers
3
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-module-utils - npm Package Compare versions

Comparing version 2.7.3 to 2.7.4

11

CHANGELOG.md

@@ -8,2 +8,10 @@ # Change Log

## v2.7.4 - 2022-08-11
### Fixed
- [Fix] Ignore hashbang and BOM while parsing ([#2431], thanks [@silverwind])
### Changed
- [patch] mark eslint as an optional peer dep ([#2523], thanks [@wmertens])
## v2.7.3 - 2022-01-26

@@ -119,2 +127,4 @@

[#2523]: https://github.com/import-js/eslint-plugin-import/pull/2523
[#2431]: https://github.com/import-js/eslint-plugin-import/pull/2431
[#2350]: https://github.com/import-js/eslint-plugin-import/issues/2350

@@ -165,1 +175,2 @@ [#2343]: https://github.com/import-js/eslint-plugin-import/pull/2343

[@VitusFW]: https://github.com/VitusFW
[@wmertens]: https://github.com/wmertens

2

moduleVisitor.js

@@ -84,3 +84,3 @@ 'use strict';

if (element.value === 'require' ||
element.value === 'exports') continue; // magic modules: https://git.io/vByan
element.value === 'exports') continue; // magic modules: https://github.com/requirejs/requirejs/wiki/Differences-between-the-simplified-CommonJS-wrapper-and-standard-AMD-define#magic-modules

@@ -87,0 +87,0 @@ checkSourceValue(element, element);

{
"name": "eslint-module-utils",
"version": "2.7.3",
"version": "2.7.4",
"description": "Core utilities to support eslint-plugin-import and other module-related plugins.",

@@ -29,5 +29,9 @@ "engines": {

"dependencies": {
"debug": "^3.2.7",
"find-up": "^2.1.0"
"debug": "^3.2.7"
},
"peerDependenciesMeta": {
"eslint": {
"optional": true
}
}
}

@@ -45,2 +45,10 @@ 'use strict';

function stripUnicodeBOM(text) {
return text.charCodeAt(0) === 0xFEFF ? text.slice(1) : text;
}
function transformHashbang(text) {
return text.replace(/^#!([^\r\n]+)/u, (_, captured) => `//${captured}`);
}
exports.default = function parse(path, content, context) {

@@ -82,2 +90,6 @@

// replicate bom strip and hashbang transform of ESLint
// https://github.com/eslint/eslint/blob/b93af98b3c417225a027cabc964c38e779adb945/lib/linter/linter.js#L779
content = transformHashbang(stripUnicodeBOM(String(content)));
if (typeof parser.parseForESLint === 'function') {

@@ -84,0 +96,0 @@ let ast;

'use strict';
exports.__esModule = true;
const findUp = require('find-up');
const fs = require('fs');
const path = require('path');
/**
* Derived significantly from package find-up@2.0.0. See license below.
*
* @copyright Sindre Sorhus
* MIT License
*
* Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
function findUp(filename, cwd) {
let dir = path.resolve(cwd || '');
const root = path.parse(dir).root;
const filenames = [].concat(filename);
// eslint-disable-next-line no-constant-condition
while (true) {
const file = filenames.find((el) => fs.existsSync(path.resolve(dir, el)));
if (file) {
return path.join(dir, file);
}
if (dir === root) {
return null;
}
dir = path.dirname(dir);
}
}
exports.default = function pkgUp(opts) {
return findUp.sync('package.json', opts);
return findUp('package.json', opts && opts.cwd);
};
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc