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

@bjervis/eslint-plugin-scoobie

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bjervis/eslint-plugin-scoobie - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

4

lib/rules.js

@@ -8,3 +8,3 @@ "use strict";

var rules = {
'no-submodule-imports': {
'no-src-import': {
meta: {

@@ -25,3 +25,3 @@ docs: {

if (importSource.startsWith('scoobie/')) {
if (importSource === 'scoobie/src') {
return context.report({

@@ -28,0 +28,0 @@ node: node,

{
"name": "@bjervis/eslint-plugin-scoobie",
"version": "1.0.1",
"version": "1.0.2",
"description": "Highlight and fix submodule imports from 'scoobie/src'.",

@@ -5,0 +5,0 @@ "main": "lib/rules.js",

# eslint-plugin-scoobie
Designed to work with projects using [scoobie](https://github.com/seek-oss/scoobie), this plugin detects when a component is being imported from a submodule.
Designed to work with projects using [scoobie](https://github.com/seek-oss/scoobie), this plugin detects when a component is being imported from the `src` submodule.
VSCode's autoimport has a strong tendency to pull from 'scoobie/src' rather than just 'scoobie', for some reason. This lint rule will error when it happens, and can also autofix.
There are some [valid reasons](https://github.com/seek-oss/scoobie#srcscoobiedts) to import from certain submodules in scoobie, and this should leave those alone.
## Example

@@ -15,2 +17,8 @@

import { SmartTextLink } from 'scoobie';
// ok
import 'scoobie/types';
// also ok
import { robotoHtml, robotoMonoHtml } from 'scoobie/typography';
```

@@ -29,3 +37,3 @@

rules: {
'@bjervis/scoobie/no-submodule-import': 2,
'@bjervis/scoobie/no-src-import': 2,
},

@@ -44,3 +52,3 @@ ```

rules: {
'@bjervis/scoobie/no-submodule-import': 2,
'@bjervis/scoobie/no-src-import': 2,
},

@@ -47,0 +55,0 @@ }),

export const rules = {
'no-submodule-imports': {
'no-src-import': {
meta: {

@@ -20,3 +20,3 @@ docs: {

if (importSource.startsWith('scoobie/')) {
if (importSource === 'scoobie/src') {
return context.report({

@@ -23,0 +23,0 @@ node,

@@ -11,14 +11,22 @@ const rules = require('../lib/rules').rules;

const submoduleImport = "import { SmartTextLink } from 'scoobie/src';";
const srcSubmoduleImport = "import { SmartTextLink } from 'scoobie/src';";
const regularImport = "import { SmartTextLink } from 'scoobie';";
const typesImport = "import 'scoobie/types';";
const nonSrcSubmoduleImport =
"import { robotoHtml, robotoMonoHtml } from 'scoobie/typography';";
const nonSeekScoobieImport =
"import { SmartTextLink } from 'other-scoobie-package/sub/module';";
const rule = rules['no-submodule-imports'];
const rule = rules['no-src-import'];
ruleTester.run('no-submodule-import', rule, {
valid: [regularImport, nonSeekScoobieImport],
ruleTester.run('no-src-import', rule, {
valid: [
regularImport,
nonSeekScoobieImport,
typesImport,
nonSeekScoobieImport,
],
invalid: [
{
code: submoduleImport,
code: srcSubmoduleImport,
errors: [{ messageId: 'submodule' }],

@@ -25,0 +33,0 @@ output: regularImport,

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