Socket
Socket
Sign inDemoInstall

eslint-mdx

Package Overview
Dependencies
Maintainers
1
Versions
109
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-mdx - npm Package Compare versions

Comparing version 1.4.5 to 1.5.1

11

CHANGELOG.md

@@ -6,2 +6,13 @@ # Change Log

## [1.5.1](https://github.com/rx-ts/eslint-mdx/compare/v1.5.0...v1.5.1) (2019-09-21)
### Bug Fixes
* correct repository field in package.json, bump devDependencies ([68799e1](https://github.com/rx-ts/eslint-mdx/commit/68799e1))
## [1.4.5](https://github.com/rx-ts/eslint-mdx/blob/master/packages/eslint-mdx/compare/v1.4.4...v1.4.5) (2019-09-09)

@@ -8,0 +19,0 @@

6

lib/helper.d.ts
/// <reference path="../typings.d.ts" />
import { AST } from 'eslint';
import { SourceLocation } from 'estree';
import { Position } from 'unist';
import { Arrayable, JsxNode, JsxTypes, ParserFn } from './types';
import { Position } from 'unist';
import { SourceLocation } from 'estree';
import { AST } from 'eslint';
export declare const FALLBACK_PARSERS: readonly ["@typescript-eslint/parser", "babel-eslint"];

@@ -7,0 +7,0 @@ export declare const JSX_TYPES: JsxTypes;

"use strict";
// eslint-disable-next-line @typescript-eslint/triple-slash-reference
/// <reference path="../typings.d.ts" />

@@ -4,0 +3,0 @@ Object.defineProperty(exports, "__esModule", { value: true });

@@ -0,5 +1,5 @@

import { AST, Linter } from 'eslint';
import unified from 'unified';
import { Node, Parent } from 'unist';
import { ParserOptions } from './types';
import { AST, Linter } from 'eslint';
import { Parent, Node } from 'unist';
export declare const mdxProcessor: unified.Processor<unified.Settings>;

@@ -6,0 +6,0 @@ export declare const AST_PROPS: readonly ["body", "comments", "tokens"];

@@ -30,2 +30,5 @@ "use strict";

};
var JSX_WRAPPER_START = '<$>';
var JSX_WRAPPER_END = '</$>';
var OFFSET = JSX_WRAPPER_START.length;
var Parser = /** @class */ (function () {

@@ -43,4 +46,4 @@ function Parser() {

}
var matched = regexp_1.COMMENT_CONTENT_REGEX.exec(value);
if (matched) {
var commentContent = regexp_1.COMMENT_CONTENT_REGEX.exec(value);
if (commentContent) {
var comments_1 = [];

@@ -108,3 +111,3 @@ var _a = node.position.start, line_1 = _a.line, column_1 = _a.column, startOffset_1 = _a.offset;

normalized = Array.isArray(normalized) ? normalized : [normalized];
normalized.forEach(function (node) { return _this._nodeToAst(node, options); });
normalized.forEach(function (_node) { return _this._nodeToAst(_node, options); });
},

@@ -141,3 +144,3 @@ });

// wrap into single element which is valid jsx but not valid jsx in mdx, so that it won't break on adjacent JSX nodes
program = this._eslintParse("<$>" + value + "</$>").ast;
program = this._eslintParse("" + JSX_WRAPPER_START + value + JSX_WRAPPER_END).ast;
}

@@ -147,4 +150,5 @@ catch (e) {

var start = node.position.start;
e.index += start.offset - 3;
e.column = e.lineNumber > 1 ? e.column : e.column + start.column - 3;
e.index += start.offset - OFFSET;
e.column =
e.lineNumber > 1 ? e.column : e.column + start.column - OFFSET;
e.lineNumber += start.line - 1;

@@ -167,4 +171,4 @@ throw e;

var endLine = line + end.line - 1;
var startOffset = range[0] - 3;
var endOffset = range[1] - 3;
var startOffset = range[0] - OFFSET;
var endOffset = range[1] - OFFSET;
nodes.push({

@@ -177,3 +181,3 @@ type: 'jsx',

line: startLine,
column: line === startLine ? start.column - 3 : start.column,
column: line === startLine ? start.column - OFFSET : start.column,
offset: offset + startOffset,

@@ -183,3 +187,3 @@ },

line: endLine,
column: line === startLine ? end.column - 3 : end.column,
column: line === startLine ? end.column - OFFSET : end.column,
offset: offset + endOffset,

@@ -204,3 +208,3 @@ },

var _a = helper_1.normalizePosition(node.position), loc = _a.loc, start = _a.start;
var startLine = loc.start.line - 1; //! line is 1-indexed, change to 0-indexed to simplify usage
var startLine = loc.start.line - 1; // ! line is 1-indexed, change to 0-indexed to simplify usage
var program;

@@ -207,0 +211,0 @@ try {

@@ -0,3 +1,3 @@

import { Node, Parent } from 'unist';
import { TraverseOptions } from './types';
import { Node, Parent } from 'unist';
export declare class Traverse {

@@ -4,0 +4,0 @@ constructor({ enter }: TraverseOptions);

import { JSXElement, JSXFragment } from '@babel/types';
import { Linter, AST } from 'eslint';
import { AST, Linter } from 'eslint';
import { Node, Parent, Point } from 'unist';

@@ -4,0 +4,0 @@ export declare type JsxNode = (JSXElement | JSXFragment) & {

{
"name": "eslint-mdx",
"version": "1.4.5",
"version": "1.5.1",
"description": "ESLint Parser for MDX",
"repository": "https://github.com/rx-ts/eslint-mdx/blob/master/packages/eslint-mdx",
"repository": {
"type": "git",
"url": "git+https://github.com/rx-ts/eslint-mdx.git",
"directory": "packages/eslint-mdx"
},
"author": "JounQin <admin@1stg.me>",

@@ -29,3 +33,3 @@ "license": "MIT",

},
"gitHead": "560d730f5dbd2ade5cd9cce9182ff74873049145"
"gitHead": "49eda2d18296a1466ae3ac2d9708225d6b26e2b3"
}

@@ -74,4 +74,12 @@ <p align="center">

1. If you're using `eslint >= 6.0.0`, add:
1. If you're using `eslint >= 6.4.0`, just add:
```json
{
"extends": ["plugin:mdx/recommended"]
}
```
2. If you're using `eslint >=6.0.0 and <6.4.0`, add as following because it does not support overrides from npm pkg:
```jsonc

@@ -101,3 +109,3 @@ {

2. If you're using `eslint@^5.0.0`, you need to enable this parser/plugin manually, because `eslint@5` does not support `extends` for `overrides` property in its configuration:
3. If you're using `eslint@^5.0.0`, you need to enable this parser/plugin manually, because `eslint@5` does not support `extends` for `overrides` property in its configuration:

@@ -104,0 +112,0 @@ ```js

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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