New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@roq/eslint-plugin

Package Overview
Dependencies
Maintainers
5
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@roq/eslint-plugin - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

7

lib/rules/imports-should-follow-conventions.js

@@ -15,3 +15,6 @@ module.exports = {

const importPathParts = node.source ? node.source.value.split('/') : [];
if (node.source && node.source.value.startsWith('..')) {
const lastPartOfImportPath = importPathParts.length > 0 ? importPathParts[importPathParts.length - 1] : '';
const dotSeparatedLastPart = lastPartOfImportPath.split('.');
const firstSectionOfLastPartOfImportPath = dotSeparatedLastPart.length <= 2 ? dotSeparatedLastPart[0] : dotSeparatedLastPart.slice(0, dotSeparatedLastPart.length - 1).join('.');
if (node.source && (node.source.value.startsWith('..') || node.source.value.startsWith('.'))) {
context.report({

@@ -22,3 +25,3 @@ node,

}
if (node.source && importPathParts.length > 0 && importPathParts[importPathParts.length - 1].startsWith('index')) {
if (node.source && firstSectionOfLastPartOfImportPath === 'index') {
context.report({

@@ -25,0 +28,0 @@ node,

@@ -78,4 +78,8 @@ const { fileContext, executionContext } = require('../../helper');

node.body.forEach((e) => {
if (e.type === 'ImportDeclaration' && e.source.value.includes('services')) {
e.specifiers.forEach((el) => importedServices.push(el.local.name));
if(e.type === 'ImportDeclaration'){
e.specifiers.forEach((el) => {
if(e.source.value.includes('services') || (el.local.name && el.local.name.toLowerCase().endsWith('service'))){
importedServices.push(el.local.name);
}
});
}

@@ -82,0 +86,0 @@ });

{
"name": "@roq/eslint-plugin",
"version": "1.1.0",
"version": "1.1.1",
"main": "index.js",

@@ -5,0 +5,0 @@ "scripts": {

@@ -34,3 +34,14 @@ const { RuleTester } = require('eslint');

},
{
code: 'import Something from "./folder/component"',
errors: [{
message: 'Use absolute path instead of relative.',
line: 1,
column: 1,
endLine: 1,
endColumn: 43,
}],
filename: 'sample.ts',
},
],
});

@@ -96,3 +96,3 @@ const { RuleTester } = require('eslint');

{
code: `/* AnyOtherDirNamePage definition */
code: `/* UsersEditPage definition */
export default AnyOtherDirNamePage;`,

@@ -99,0 +99,0 @@ errors: [

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