diff --git a/lib/rules/property-no-unknown/__tests__/index.js b/lib/rules/property-no-unknown/__tests__/index.js index 14bc4cbb64..a5c6bb6900 100644 --- a/lib/rules/property-no-unknown/__tests__/index.js +++ b/lib/rules/property-no-unknown/__tests__/index.js @@ -124,6 +124,10 @@ testRule({ code: '.foo { transform+_: rotate(15deg); }', description: 'Append property value with space using +_', }, + { + code: '@foo: { prop: red; }', + description: 'ignore LESS map props', + }, ], }); diff --git a/lib/utils/__tests__/isStandardSyntaxDeclaration.test.js b/lib/utils/__tests__/isStandardSyntaxDeclaration.test.js index 3007100ace..7675150b89 100644 --- a/lib/utils/__tests__/isStandardSyntaxDeclaration.test.js +++ b/lib/utils/__tests__/isStandardSyntaxDeclaration.test.js @@ -134,6 +134,10 @@ describe('isStandardSyntaxDeclaration', () => { it('less &:extend', () => { expect(isStandardSyntaxDeclaration(lessDecl('a { &:extend(b) }'))).toBe(false); }); + + it('less map', () => { + expect(isStandardSyntaxDeclaration(lessDecl('@map: { key: value; }'))).toBe(false); + }); }); function decl(css, parser = postcss) { diff --git a/lib/utils/isStandardSyntaxDeclaration.js b/lib/utils/isStandardSyntaxDeclaration.js index 22380cfe04..0552a69138 100644 --- a/lib/utils/isStandardSyntaxDeclaration.js +++ b/lib/utils/isStandardSyntaxDeclaration.js @@ -41,6 +41,11 @@ module.exports = function (decl) { return false; } + // Less map declaration + if (parent && parent.type === 'atrule' && parent.raws.afterName === ':') { + return false; + } + // Sass nested properties (e.g. border: { style: solid; color: red; }) if ( // @ts-ignore TODO TYPES selector does not exists